• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

3K
Views
ENOENT: no such file or directory, lstat '/Users/Desktop/node_modules'

An unhandled exception occurred:

ENOENT: no such file or directory, lstat 
'/Users/Desktop/node_modules'
See "/private/var/folders/3p/l_k1wk8n76v3cfwnxk0blx000000gn/T/ng- 
DF5EZ7/angular-errors.log" for further details.

Whenever i am doing ng serve, this error occurs, Can anyone tell me what is the cause of error. stuck in this since long hours.

over 3 years ago · Santiago Trujillo
18 answers
Answer question

0

I had the same error when I tried installing an old version of bootstrap and referenced it in the angular.json file. Meanwhile, the package was never installed because it doesn't exist anymore. Check the new command for installing a particular package and after doing npm i <package-name> check in node_modules if it's there.

And also, I changed my bootstrap path from

../node_modules/bootstrap/dist/css/bootstrap.css

to

node_modules/bootstrap/dist/css/bootstrap.css
over 3 years ago · Santiago Trujillo Report

0

  1. Download manually bootstrap from https://www.npmjs.com/package/bootstrap .
  2. Copy and past the folder you download to /Users/Desktop/node_modules .
  3. In CMD, enter to your project folder you created by typing: CD yourProjectName .
  4. In CMD: ng serve.
  5. In your browser: http://localhost:4200/
over 3 years ago · Santiago Trujillo Report

0

I had this problem, it was just:

  1. Works "styles": [ "node_modules/bootstrap/dist/css/bootstrap.min.css"

  2. Not works "styles": [ "../node_modules/bootstrap/dist/css/bootstrap.min.css"

over 3 years ago · Santiago Trujillo Report

0

So to sum up what is the cause of the issue. Its that the node_modules is not being read well from the angular.json file

over 3 years ago · Santiago Trujillo Report

0

You need to check with the path of bootstrap in angular.json inside architect then styles

over 3 years ago · Santiago Trujillo Report

0

In my case i removed the "../node_modules/bootstrap/dist/css/bootstrap.min.css" from angular.json

over 3 years ago · Santiago Trujillo Report

0

Solving the problems on angular.json then deleting package-lock.json solved my problem.

My problem was related to a deleted package @angular/material. Angular.json styles were still referencing that package, I deleted those lines. Then I deleted the package-lock.json and execute it.

over 3 years ago · Santiago Trujillo Report

0

In my case, my problem was a misspelling issue in the directory URL inside Angular.json. So I corrected the error and the apps run perfectly afterwards.

Not working: (misspelled on "node_modules")

"styles": ["./node_moodules/font-awesome/css/font-awesome.css"]

Working:

"styles": ["./node_modules/font-awesome/css/font-awesome.css"]

try checking your url path in Angular.json, this probably the case, hopefully this helps!

over 3 years ago · Santiago Trujillo Report

0

I had the same problem. But I found a Solution which works for me.

Try:

npm install --save bootstrap

and then add in angular.json at "styles":

"node_modules/bootstrap/dist/css/bootstrap.min.css"

run the Project (Watch if youre in the right folder you can check it with typing in terminal ls and and then you should see node_modules, src etc.)

ng serve

over 3 years ago · Santiago Trujillo Report

0

I had this problem on a non-Angular project; here's what worked for me:

  1. update node and npm
  2. delete package-lock.json
  3. run npm install --package-lock-only
over 3 years ago · Santiago Trujillo Report

0

As @Manuel Villadiego said, you must define your bootstrap path like below:

"node_modules/bootstrap/dist/css/bootstrap.min.css"

Or

"./node_modules/bootstrap/dist/css/bootstrap.min.css"

This error will happen when you start bootstrap path with ../ ,

"../node_modules/bootstrap/dist/css/bootstrap.min.css"

because you go back one folder and node_modules folder doesn't exist there.

over 3 years ago · Santiago Trujillo Report

0

Usually, it happens when

package-lock.json

was created by another version of the node js (I'm using the latest LTS version).

Just remove it and try again, this is OK.

over 3 years ago · Santiago Trujillo Report

0

if: npm install bootstrap then "./node_modules/bootstrap/dist/css/bootstrap.min.css"

if npm install --save bootstrap then "node_modules/bootstrap/dist/css/bootstrap.min.css"

over 3 years ago · Santiago Trujillo Report

0

Step 1) npm install --save bootstrap

Step 2) and then add in angular.json at "styles": "./node_modules/bootstrap/dist/css/bootstrap.min.css",

Step 3) ng serve

Problem solved

image showing the solution

over 3 years ago · Santiago Trujillo Report

0

I just had the same issue, I removed the followings from angular.json which I had just added and the issue is resolved.

          "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
          "src/styles/styles.scss",
          "src/styles/colors.scss"
over 3 years ago · Santiago Trujillo Report

0

I was facing similar error:

 An unhandled exception occurred: ENOENT: no such file or directory, lstat 
'C:\User_Name\Angular\node_modules\bootstrap'
See "C:\Users\User_Name\AppData\Local\Temp\ng-MhR1Ls\angular-errors.log" for further details.

This was caused due to adding this in styles array:

    "styles": [
          "src/styles.css",
          "../node_modules/bootstrap/dist/css/bootstrap.min.css"
        ]

Solved it by changing styles array with

    "styles": [
          "src/styles.css",
          "node_modules/bootstrap/dist/css/bootstrap.min.css"
        ]

This may have happened cause I made another angular project inside the parent folder or directory since "." denotes the home directory. This is just my understanding and the solution of the issue.

Please check whether you have added your current component.html file i.e. unique selector in your app.component.html file

Recently started my angular journey so cheers!!

over 3 years ago · Santiago Trujillo Report

0

I removed the file from angular.json and added it to style.css.

@import '../node_modules/ngx-bootstrap/datepicker/bs-datepicker.css'
over 3 years ago · Santiago Trujillo Report

0

Just do:

npm install --force and then npm audit fix --force

over 3 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error