当我执行 ng s --open 命令
时,出现以下错误找不到模块'@ angular / compiler-cli'错误:找不到模块 '@ angular / compiler-cli' 在Function.Module._resolveFilename(内部/模块/cjs/loader.js:655:15) 在Function.Module._load(内部/模块/cjs/loader.js:580:25) 在Module.require(内部/模块/cjs/loader.js:711:19) 在要求时(内部/模块/cjs/helpers.js:14:16) 在对象。 (G:\ Front \ End \ angular \ rapydly \ node_modules @ ngtools \ webpack \ src \ angular_compiler_plugin.js:12:24) 在Module._compile(内部/模块/cjs/loader.js:805:30) 在Object.Module._extensions..js(内部/模块/cjs/loader.js:816:10) 在Module.load(内部/模块/cjs/loader.js:672:32) 在tryModuleLoad(内部/模块/cjs/loader.js:612:12) 在Function.Module._load(internal / modules / cjs / loader.js:604:3) 在Module.require(内部/模块/cjs/loader.js:711:19) 在要求时(内部/模块/cjs/helpers.js:14:16) 在对象。 (G:\ Front \ End \ angular \ rapydly \ node_modules @ ngtools \ webpack \ src \ index.js:13:10) 在Module._compile(内部/模块/cjs/loader.js:805:30) 在Object.Module._extensions..js(内部/模块/cjs/loader.js:816:10) 在Module.load(内部/模块/cjs/loader.js:672:32) 在tryModuleLoad(内部/模块/cjs/loader.js:612:12) 在Function.Module._load(internal / modules / cjs / loader.js:604:3) 在Module.require(内部/模块/cjs/loader.js:711:19) 在要求时(内部/模块/cjs/helpers.js:14:16) 在对象。 (G:\ Front \ End \ angular \ rapydly \ node_modules @ angular-devkit \ build-angular \ src \ angular-cli-files \ models \ webpack-configs \ typescript.js:4:19) 在Module._compile(internal / modules / cjs / loader.js:805:30)
这是我的 package.json 文件
{
"name": "rapid",
"version": "1.1.9",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --prod",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^5.2.0",
"@angular/common": "^5.2.0",
"@angular/compiler": "^5.2.0",
"@angular/core": "^5.2.0",
"@angular/forms": "^5.2.0",
"@angular/http": "^5.2.0",
"@angular/platform-browser": "^5.2.0",
"@angular/platform-browser-dynamic": "^5.2.0",
"@angular/router": "^5.2.0",
"@asymmetrik/ngx-leaflet": "^4.0.0",
"@dvsl/zoomcharts": "^1.18.4",
"@ng-bootstrap/ng-bootstrap": "^4.0.3",
"@types/c3": "^0.6.0",
"angular-2-dropdown-multiselect": "^1.8.1",
"angular-confirmation-popover": "^4.2.0",
"angular-datatables": "^6.0.0",
"angular2-tag-input": "^1.2.3",
"angular2-toaster": "^6.1.0",
"aws-sdk": "^2.271.1",
"bootstrap": "^3.3.7",
"bootstrap-daterangepicker": "^3.0.3",
"c3": "^0.6.6",
"core-js": "^2.4.1",
"crypto-js": "^3.1.9-1",
"datatables.net": "^1.10.18",
"datatables.net-dt": "^1.10.18",
"file-saver": "^2.0.0",
"jquery": "^3.3.1",
"leaflet": "^1.3.4",
"moment": "^2.22.2",
"ng-multiselect-dropdown": "^0.1.9",
"ng-recaptcha": "^4.2.1",
"ng2-table": "^1.3.2",
"ng2-tooltip-directive": "^2.1.6",
"ngx-bootstrap": "^3.1.2",
"ngx-cookie-service": "^1.0.10",
"ngx-popover": "0.0.16",
"ngx-spinner": "^6.0.0",
"ngx-tooltip": "0.0.9",
"ngx-webstorage": "^2.0.1",
"popper.js": "^1.14.3",
"rxjs": "^5.5.6",
"tslib": "^1.9.0",
"xlsx": "^0.14.1",
"zone.js": "^0.8.19"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.12.4",
"@angular/cli": "^7.2.1",
"@angular/compiler-cli": "^5.2.0",
"@angular/language-service": "^5.2.0",
"@types/datatables.net": "^1.10.11",
"@types/jasmine": "~2.8.3",
"@types/jasminewd2": "~2.0.2",
"@types/jquery": "^3.3.4",
"@types/node": "~6.0.60",
"codelyzer": "^4.0.1",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^3.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "^5.4.0",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"typescript": "~2.5.3"
}
}
有人可以指导我解决错误的问题是什么。我正在Windows平台上工作。我卸载了先前的节点版本并安装了新版本,但仍然出现相同的错误。
答案 0 :(得分:1)
只需按照步骤->
手动删除您的node_modules文件夹或 rm -r node_modules
清理npm缓存-> 清理npm缓存
通过运行 npm install
答案 1 :(得分:0)
通过执行npm i @angular/compiler-cli
,一切都会像以前一样完美
答案 2 :(得分:0)
当我第一次运行从Azure devops存储库克隆的angular 7应用程序时,我遇到了同样的问题。只需在Visual Studio代码中的节点终端上执行以下命令,即可解决错误。
npm i @angular/compiler-cli
答案 3 :(得分:-2)
这有效:-npm i @ angular / compiler-cli