[英]Angular Build is getting failed
I have issue related to Angular build. 我有与Angular构建相关的问题。 Below is my dependencies in package.json file 以下是我对package.json文件的依赖
"dependencies": {
"@angular/animations": "^6.1.10",
"@angular/common": "^6.1.0",
"@angular/compiler": "^6.1.0",
"@angular/core": "^6.1.0",
"@angular/forms": "^6.1.0",
"@angular/platform-browser": "^6.1.0",
"@angular/platform-browser-dynamic": "^6.1.0",
"@angular/router": "^6.1.0",
"@fortawesome/angular-fontawesome": "^0.3.0",
"@fortawesome/fontawesome-svg-core": "^1.2.17",
"@fortawesome/free-solid-svg-icons": "^5.8.1",
"@ng-select/ng-select": "^2.15.3",
"@ngtools/webpack": "^6.2.9",
"alertifyjs": "^1.11.2",
"bootstrap": "^4.1.1",
"core-js": "^2.5.4",
"d3": "^5.9.2",
"jquery": "^3.4.1",
"ngx-bootstrap": "^3.1.3",
"ngx-toastr": "^9.1.2",
"nyc": "^14.1.1",
"popper.js": "^1.15.0",
"rxjs": "^6.2.2",
"rxjs-compat": "^6.4.0",
"zone.js": "~0.8.26"},
"devDependencies": {
"@angular-devkit/build-angular": "~0.8.0",
"@angular/cli": "~6.2.3",
"@angular/compiler-cli": "^8.2.0",
"@angular/language-service": "^6.1.0",
"@types/d3": "^5.7.1",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.3.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "^3.5.3"}
and i am trying to run application with npm start which is returning me error like, 我正在尝试使用npm start运行应用程序,这会向我返回错误,例如,
Could not find API compiler-cli, function VERSION 找不到API编译器CLI,函数VERSION
Error: Could not find API compiler-cli, function VERSION
at _error (D:\Ketan\Projects\myproject\node_modules\@ngtools\webpack\src\ngtools_api.js:8:11)
at getApiMember (D:\Ketan\Projects\myproject\node_modules\@ngtools\webpack\src\ngtools_api.js:11:32)
at Object.<anonymous> (D:\Ketan\Projects\myproject\node_modules\@ngtools\webpack\src\ngtools_api.js:50:19)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (D:\Ketan\Projects\myproject\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:28:23)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myproject@0.0.0 start: `ng serve --proxy-config proxy.conf.json`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myproject@0.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ketan.jariwala\AppData\Roaming\npm-cache\_logs\2019-08-02T10_58_01_702Z-debug.logCould not find API compiler-cli, function VERSION
Error: Could not find API compiler-cli, function VERSION
at _error (D:\Ketan\Projects\myproject\node_modules\@ngtools\webpack\src\ngtools_api.js:8:11)
at getApiMember (D:\Ketan\Projects\myproject\node_modules\@ngtools\webpack\src\ngtools_api.js:11:32)
at Object.<anonymous> (D:\Ketan\Projects\myproject\node_modules\@ngtools\webpack\src\ngtools_api.js:50:19)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (D:\Ketan\Projects\myproject\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:28:23)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myproject@0.0.0 start: `ng serve --proxy-config proxy.conf.json`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myproject@0.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ketan.jariwala\AppData\Roaming\npm-cache\_logs\2019-08-02T10_58_01_702Z-debug.logCould not find API compiler-cli, function VERSION
Error: Could not find API compiler-cli, function VERSION
at _error (D:\Ketan\Projects\myproject\node_modules\@ngtools\webpack\src\ngtools_api.js:8:11)
at getApiMember (D:\Ketan\Projects\myproject\node_modules\@ngtools\webpack\src\ngtools_api.js:11:32)
at Object.<anonymous> (D:\Ketan\Projects\myproject\node_modules\@ngtools\webpack\src\ngtools_api.js:50:19)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (D:\Ketan\Projects\myproject\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:28:23)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myproject@0.0.0 start: `ng serve --proxy-config proxy.conf.json`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myproject@0.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Any help please! 请帮忙! Thanks in advance! 提前致谢!
Try below given command: 请尝试以下给定的命令:
npm i --save-dev @angular/cli @angular-devkit/build-angular @angular/compiler @angular/compiler-cli
It will install above given packages. 它将安装在给定的软件包之上。
Then you need to do npm start
or ng serve
然后,您需要执行npm start
或ng serve
first you have to remove node_module . 首先,您必须删除node_module。 Then clear npm cache. 然后清除npm缓存。
https://www.npmjs.com/package/@angular/core https://www.npmjs.com/package/@angular/core
https://www.npmjs.com/package/@angular/cli https://www.npmjs.com/package/@angular/cli
npm cache clean --verify --force
npm install -g @angular/cli
npm i @angular/core
npm install
There's some version difference between your cli and compiler-cli versions. cli版本和cli-cli版本之间存在一些版本差异。 Uninstall every module globally. 全局卸载每个模块。 Clear your cache and then re-install all the modules. 清除缓存,然后重新安装所有模块。
$ npm uninstall -g @angular/cli @angular-devkit/build-angular @angular/compiler @angular/compiler-cli
$ npm cache clean
$ npm install --save-dev @angular/cli @angular-devkit/build-angular @angular/compiler @angular/compiler-cli
Also check if tslib has to be added to your package.json file 还要检查tslib是否必须添加到package.json文件中
"dependencies": {
["tslib": "^1.9.0"]
}
and repeat the above steps. 并重复以上步骤。 Good luck! 祝好运!
You can use these command to see if it work. 您可以使用这些命令来查看它是否有效。
npm uninstall angular-cli -g
npm uninstall angular-cli --save
npm install -g @angular/cli
npm install @angular/cli --save
npm install @angular/compiler-cli --save
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.