我想创建一个新的angular 7项目。当我运行命令“ ng new Portfolio”时,可以将所有内容设置为所需的内容(路由和样式表)。这可行,但是在安装节点模块时,出现错误:
813 verbose stack Error: 403 Forbidden: @angular/animations@~7.0.0
813 verbose stack at fetch.then.res (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\lib\fetchers\registry\fetch.js:42:19)
813 verbose stack at tryCatcher (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23)
813 verbose stack at Promise._settlePromiseFromHandler (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:512:31)
813 verbose stack at Promise._settlePromise (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:569:18)
813 verbose stack at Promise._settlePromise0 (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:614:10)
813 verbose stack at Promise._settlePromises (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:693:18)
813 verbose stack at Async._drainQueue (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\async.js:133:16)
813 verbose stack at Async._drainQueues (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\async.js:143:10)
813 verbose stack at Immediate.Async.drainQueues [as _onImmediate] (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\async.js:17:14)
813 verbose stack at runCallback (timers.js:705:18)
813 verbose stack at tryOnImmediate (timers.js:676:5)
813 verbose stack at processImmediate (timers.js:658:5)
814 verbose cwd D:\Development\Webdevelopment\portfolio
815 verbose Windows_NT 10.0.17134
816 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--quiet"
817 verbose node v10.15.0
818 verbose npm v6.4.1
819 error code E403
820 error 403 Forbidden: @angular/animations@~7.0.0
821 verbose exit [ 1, true ]
问题是我无法安装节点模块。接下来,我在网上搜索并找到了一些最终可以帮助您的答案。
Here,他们说我应该在管理员模式下运行命令提示符或重置代理配置。我进行了更改并删除了该项目。然后,我再次尝试ng new。那也不起作用。然后我有了一个主意。我可以使用npm install自己安装节点模块。我试过了,但出现了错误:
810 verbose stack Error: 403 Forbidden: @angular/animations@~7.0.0
810 verbose stack at fetch.then.res (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\lib\fetchers\registry\fetch.js:42:19)
810 verbose stack at tryCatcher (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23)
810 verbose stack at Promise._settlePromiseFromHandler (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:512:31)
810 verbose stack at Promise._settlePromise (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:569:18)
810 verbose stack at Promise._settlePromise0 (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:614:10)
810 verbose stack at Promise._settlePromises (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:693:18)
810 verbose stack at Async._drainQueue (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\async.js:133:16)
810 verbose stack at Async._drainQueues (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\async.js:143:10)
810 verbose stack at Immediate.Async.drainQueues [as _onImmediate] (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\async.js:17:14)
810 verbose stack at runCallback (timers.js:705:18)
810 verbose stack at tryOnImmediate (timers.js:676:5)
810 verbose stack at processImmediate (timers.js:658:5)
811 verbose cwd D:\Development\Webdevelopment\portfolio
812 verbose Windows_NT 10.0.17134
813 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
814 verbose node v10.15.0
815 verbose npm v6.4.1
816 error code E403
817 error 403 Forbidden: @angular/animations@~7.0.0
818 verbose exit [ 1, true ]
如何解决此错误?
答案 0 :(得分:0)
我唯一的解决方案是重置笔记本电脑,因为经过大量研究,我什么都没发现。我不知道问题出在什么地方,但是现在它又能正常工作了,我希望我再也不会遇到这个愚蠢的错误...