“你似乎并不依赖于“@angular/core"." [英] "You seem to not be depending on "@angular/core"."
问题描述
当我尝试运行以下命令构建我的项目时:
When I try to build my project running the following command:
ng build --environment=prod --aot=false --output-path="..." --base-href="..."
你似乎不依赖于@angular/core
.
这是一个错误,但是,我不明白为什么,因为之前它运行良好.
This is an error, however, I don't understand why because before it worked well.
我尝试这样做:
npm install @angular/core
但我收到此错误:
error at Error(原生)错误 { 错误:EACCES:权限被拒绝,chown ''错误处的错误(本机)错误号:-13,错误代码:'EACCES',错误系统调用:'chown',错误 请尝试以 root/管理员身份再次运行此命令.详细退出 [ -13, true ]
我也试图摆脱node_modules
,然后安装npm:但我得到了同样的错误.
I also tried to get rid of node_modules
, then make an install npm: but I get the same error.
当我运行以下命令时:
ng serve
我还有一个错误:
@angular/compiler-cli"包没有正确安装.错误:错误:找不到模块'@angular/compiler-cli'
这是我的package.json
:
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
"@angular/animations": "^4.0.0",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"@types/jquery": "^3.2.17",
"cli-color": "^1.2.0",
"core-js": "^2.4.1",
"font-awesome": "^4.7.0",
"jquery": "^3.2.1",
"matrix-js-sdk": "^0.8.5",
"moment": "^2.18.1",
"olm": "https://matrix.org/packages/npm/olm/olm-2.2.2.tgz",
"readline": "^1.3.0",
"rxjs": "^5.4.1",
"socket.io-client": "^2.0.3",
"zone.js": "^0.8.14"
"@angular/cli": "1.2.6",
"@angular/compiler-cli": "^4.0.0",
"@angular/language-service": "^4.0.0",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/jquery": "^3.2.17",
"@types/node": "~6.0.60",
"codelyzer": "~3.0.1",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.0.4",
"tslint": "~5.3.2",
"typescript": "~2.3.3"
推荐答案
不确定以下方法是否能解决您的问题,请尝试一次.
Not sure whether below approach will solve your problem or not, please try once.
我在执行以下命令时也遇到了同样的问题.
I have also faced the same issue while executing below command.
D:\My_Project>ng serve
然后我按照以下步骤操作,它对我有用.
Then I have followed below steps and it worked for me.
D:\My_Project>npm link
D:\My_Project>ng serve
如果这不起作用,请告诉我,我会尝试重现您遇到的错误,并尽快为您提供解决方案.
If this is not working kindly let me know I will try to reproduce the error which you are getting and try to give you solution as soon as possible.
这篇关于“你似乎并不依赖于“@angular/core"."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!