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

51,288

Solution 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

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

Solution with yarn:

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

Solution 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

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

Share:
51,288

Related videos on Youtube

Raheem Mohamed
Author by

Raheem Mohamed

My Name is Raheem, I am a Full Stack Developer with full system development life cycle experience including designing, development, and implementing test plans, test cases, and test processes offering over 5+ years of experience in software development, testing and web applications, frontend and backend development. I am Strong team builder and leader. self-motivated and committed to the successful outcome of the project. and Well-versed in technology and writing code to create systems that are reliable and user-friendly.

Updated on April 20, 2022

Comments

  • Raheem Mohamed
    Raheem Mohamed about 2 years

    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"
      }
    }
    
    • yazan
      yazan over 3 years
      Could you provide your package.json file
  • Apoorva Chikara
    Apoorva Chikara over 3 years
    have you tried deleting npm cache? -- delete the "NPM" and "Npm-cache" folder under "Roaming" folder.
  • Apoorva Chikara
    Apoorva Chikara over 3 years
    Can you check the entry point in your package.json? Sometimes the path is incorrect or you can just reinstall the node dependencies using npm i.
  • Apoorva Chikara
    Apoorva Chikara over 3 years
    "scripts": { "start": "ng serve" } you should make this change in your package.json
  • Raheem Mohamed
    Raheem Mohamed over 3 years
    package.json file updated with the question, @Apoorva Chikara
  • Apoorva Chikara
    Apoorva Chikara over 3 years
    My bad just forgot to check it, just remove ng from the file and it will work.
  • Apoorva Chikara
    Apoorva Chikara over 3 years
    "scripts": { "ng": "ng", <---- remove this line this is no command in angular "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" },
  • Apoorva Chikara
    Apoorva Chikara over 3 years
    If that works can you accept the answer as i have update it in the above solution
  • Raheem Mohamed
    Raheem Mohamed over 3 years
    Yes @Apoorva Chikara
  • Apoorva Chikara
    Apoorva Chikara over 3 years
    there might be a issue with env path. There might be an issue with the way npm,node or angular installed that is why this is causing an issue
  • Anita
    Anita about 3 years
    above error is ignorable, I spent an hr. to figure out what could be the issue and then after spending a long time thought of ignoring this error and go ahead with ng serve --host 0.0.0.0, it simply ran my application with no error.