安装角材料时出错

时间:2018-05-09 06:41:26

标签: node.js angular

我尝试使用以下命令为角度4安装角度材质。

npm install --save @angular/material @angular/animations

但是我收到以下错误消息。如何解决这个问题并为角度4安装角度材料?

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   '--save',
1 verbose cli   '@angular/material',
1 verbose cli   '@angular/animations' ]
2 info using npm@5.6.0
3 info using node@v9.8.0
4 verbose npm-session 2a4ce4a582a48cef
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 403 https://registry.npmjs.org/@angular%2fmaterial 119ms
8 silly fetchPackageMetaData error for @angular/material@latest 403 Forbidden: @angular/material@latest
9 http fetch GET 403 https://registry.npmjs.org/@angular%2fanimations 162ms
10 silly fetchPackageMetaData error for @angular/animations@^5.2.0 403 Forbidden: @angular/animations@^5.2.0
11 verbose stack Error: 403 Forbidden: @angular/material@latest
11 verbose stack     at fetch.then.res (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\lib\fetchers\registry\fetch.js:42:19)
11 verbose stack     at tryCatcher (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23)
11 verbose stack     at Promise._settlePromiseFromHandler (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:512:31)
11 verbose stack     at Promise._settlePromise (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:569:18)
11 verbose stack     at Promise._settlePromise0 (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:614:10)
11 verbose stack     at Promise._settlePromises (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:693:18)
11 verbose stack     at Async._drainQueue (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\async.js:133:16)
11 verbose stack     at Async._drainQueues (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\async.js:143:10)
11 verbose stack     at Immediate.Async.drainQueues [as _onImmediate] (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\async.js:17:14)
11 verbose stack     at runCallback (timers.js:763:18)
11 verbose stack     at tryOnImmediate (timers.js:734:5)
11 verbose stack     at processImmediate (timers.js:716:5)
12 verbose cwd D:\Projects\cbc-ipg-payments
13 verbose Windows_NT 10.0.15063
14 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "@angular/material" "@angular/animations"
15 verbose node v9.8.0
16 verbose npm  v5.6.0
17 error code E403
18 error 403 Forbidden: @angular/material@latest
19 verbose exit [ 1, true ]

2 个答案:

答案 0 :(得分:1)

如果你在代理后面,你应该配置npm使用它:

$ npm config set proxy http://<username>:<password>@<proxy-server-url>:<port>
$ npm config set https-proxy http://<username>:<password>@<proxy-server-url>:<port>

您必须使用特定于代理服务器凭据的值替换<username><password><proxy-server-url><port>

答案 1 :(得分:0)

我建议您删除node_modules文件夹,然后重新运行并进行npm install,然后对sudo使用相同的命令。