'internal/modules/cjs/loader.js:883 throw err

I've ran into an issue running npm start (I've attached the screenshot of the error bellow) on my Angular project.

When I run the project using ng serve, everything is working fine.

I have tried several ways to fix this issue without success.

Screenshot of the error

This is my package.json file:

{
  "name": "myapplication",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~11.0.6",
    "@angular/common": "~11.0.6",
    "@angular/compiler": "~11.0.6",
    "@angular/core": "~11.0.6",
    "@angular/forms": "~11.0.6",
    "@angular/platform-browser": "~11.0.6",
    "@angular/platform-browser-dynamic": "~11.0.6",
    "@angular/router": "~11.0.6",
    "rxjs": "~6.6.0",
    "tslib": "^2.0.0",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.1100.6",
    "@angular/cli": "~11.0.6",
    "@angular/compiler-cli": "~11.0.6",
    "@types/jasmine": "~3.6.0",
    "@types/node": "^12.11.1",
    "codelyzer": "^6.0.0",
    "jasmine-core": "~3.6.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~5.1.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "~4.0.2"
  }
}


Solution 1:[1]

After spending a lot of time on the issue, I finally found the solution.

I've uninstalled "NodeJs" completely, deleted "NPM" & "NPM-Cache" from:

C:\Users\username\AppData\Roaming

and restarted the PC. Then I've re-installed everything.


If the issue remains, check your folder names.

In my case, the Angular project was inside a folder named "Research & Development":

C:\Users\Asus\Documents\Research & Development\Video conference project\myapplication

I have removed the special character "&" and renamed the folder to "Research-Development"

After the rename, npm start executed without errors.

Command line screenshot

Solution 2:[2]

the solution is:

Delete node_modules and package-lock.json, then run $ npm install again.

You can also try updating your version of node.

Check version with $ node -v, install with $ sudo n stable

Solution 3:[3]

Solution with yarn:

  1. remove /node_modules and yarn.lock file.
  2. reinstall packages/file using yarn install .

Solution 4:[4]

I was receiving this error in my screenshot (...883 throw error). I tried deleting package-lock.json and node_modules, then npm i, with no luck. For me, the error was in my package.json file. I had "seed": "node server/config/seeds.js" in my scripts instead of "seed": "node config/seeds.js" (which, it didn't need to direct to server because it was already within the server directory, I think? Still learning.).

Just wanted to add what helped solve this error for me since I have yet to see any solutions that match mine. Shoutout to Enricop89 because I only looked in my package.json due to his "nodemon" comment above! screenshot of error

Solution 5:[5]

In my case, I was running the wrong file using nodemon. So for example I was running nodemon server.js which didn't exist.

I changed to the correct one, nodemon src/server.js and got it working

Solution 6:[6]

Just this has happened to me with node.js and I have solved it by changing the way to execute the file, I mean that if I executed it with npm start I would execute it with npm ./src/index.js (for example), you can try and me you say if it worked for you

Solution 7:[7]

In my case I just removed the following entry from the PATH system variable:

C:\Users\username\AppData\Roaming\npm

It could be found like this too:

%APPDATA%\npm

But I guess each case could be different.

Solution 8:[8]

Uninstalled "NodeJs" completely, deleted "NPM" & "NPM-Cache" from:

Check your architecture whether its 32 bit processor or 64 bit processor for downloading the node.js. When reinstall the node.js, the issue is completely resolved.

Solution 9:[9]

I was running the wrong file using nodemon. I changed package.json entry for dev which is starting the nodemon.

"scripts": { "start": "node dist/app.js", "dev": "nodemon src/app.ts", "build": "tsc -p ." }

I changed to the correct one, and got it working //wrong one: nodemon app.ts //correct one: nodemon src/app.ts

Solution 10:[10]

Just rename your file path without spaces. Spent hours on it. E.g.

Video conference project/myapplication

to

video-conference-project/myapplication

Solution 11:[11]

I had the same issue. What worked for me is the below solution:

I've uninstalled "NodeJs", deleted "NPM" & "NPM-Cache" from: C:\Users\username\AppData\Roaming

I reinstalled NodeJS and also angular-cli again. Also, Once you install the angular-cli, make sure the node-modules folder gets created in below location: C:\Users\username\AppData\Roaming\npm

Solution 12:[12]

I changed & to nothing just extra & sign was added to my file name. I took it out and I closed the VSC and reopen again it works as it was before.