Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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"
  }
}
like image 892
Raheem Mohamed Avatar asked Jan 10 '21 12:01

Raheem Mohamed


2 Answers

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

like image 53
Raheem Mohamed Avatar answered Oct 10 '22 18:10

Raheem Mohamed


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

like image 44
Apoorva Chikara Avatar answered Oct 10 '22 18:10

Apoorva Chikara