内部/模块/cjs/loader.js:883 抛出错误 [英] internal/modules/cjs/loader.js:883 throw err

查看:68
本文介绍了内部/模块/cjs/loader.js:883 抛出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的 Angular 项目中运行 npm start 时遇到了问题(我附上了错误的屏幕截图).

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

当我使用 ng serve 运行项目时,一切正常.

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

我尝试了多种方法来解决此问题,但均未成功.

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

这是我的 package.json 文件:

{
  "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"
  }
}

推荐答案

在这个问题上花了很多时间,我终于找到了解决方案.

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

我已经完全卸载了NodeJs",删除了NPM" &NPM-Cache"来自:

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

C:\Users\username\AppData\Roaming

并重新启动PC.然后我重新安装了所有东西.

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

如果问题仍然存在,请检查您的文件夹名称.

If the issue remains, check your folder names.

就我而言,Angular 项目位于名为 "Research & 的文件夹中.发展:

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

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

我删除了特殊字符&"并将文件夹重命名为Research-Development"

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

重命名后,npm start 执行没有错误.

After the rename, npm start executed without errors.

这篇关于内部/模块/cjs/loader.js:883 抛出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆