npm安装在@angular失败/cli@9.1.3安装后脚本



我刚开始,我需要在我的机器上设置一个源代码。

节点-vv12.16.1npm-v6.13.4

当我运行npm install命令(在Windows 7 Entreprise SP1 64位上(时,你能帮我解决这个错误吗

4400 verbose stack Error: @angular/cli@9.1.3 postinstall: `node 
./bin/postinstall/script.js`
4400 verbose stack Exit status 1
4400 verbose stack     at EventEmitter.<anonymous> (C:Program 
Filesnodejsnode_modulesnpmnode_modulesnpm-lifecycleindex.js:332:16)
4400 verbose stack     at EventEmitter.emit (events.js:311:20)
4400 verbose stack     at ChildProcess.<anonymous> (C:Program 
Filesnodejsnode_modulesnpmnode_modulesnpm-lifecyclelibspawn.js:55:14)
4400 verbose stack     at ChildProcess.emit (events.js:311:20)
4400 verbose stack     at maybeClose (internal/child_process.js:1021:16)
4400 verbose stack     at Process.ChildProcess._handle.onexit 
(internal/child_process.js:286:5)
4401 verbose pkgid @angular/cli@9.1.3
4402 verbose cwd D:banbou_sourceworkspacebanbou-projectbanbou-backoffice- 
client
4403 verbose Windows_NT 6.1.7601
4404 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program 
Files\nodejs\node_modules\npm\bin\npm-cli.js" "install"
4405 verbose node v12.16.1
4406 verbose npm  v6.13.4
4407 error code ELIFECYCLE
4408 error errno 1
4409 error @angular/cli@9.1.3 postinstall: `node ./bin/postinstall/script.js`
4409 error Exit status 1
4410 error Failed at the @angular/cli@9.1.3 postinstall script.
4410 error This is probably not a problem with npm. There is likely 
additional 
logging output above.
4411 verbose exit [ 1, true ]

感谢您在添加--force选项后解决了所有问题

npm i-g@angular/cli--强制

您必须检查您的计算机上是否安装了Agular上的任何早期版本(甚至部分安装(。如果是,则运行命令:

npm uinstall @angular/cli

然后通过以下命令清理npm缓存:npm cache clean --force

现在,尝试通过以下命令重新安装Angular:npm i -g @angular/cliAngular的当前版本是9.1.3,因此不需要在命令中编写它。

这里-g命令用于全局安装Angular。

为了一切正常,请关闭所有IDE(如果正在使用(,然后执行以上操作。

尝试使用--unsafe-perm标志安装angular cli。在Windows中,安装postinstall时可能存在权限问题。

我不知道其中哪一个成功了,也不知道它是否是一个组合,但在尝试了这么多其他答案后,这对我来说很有效。

我在Windows中以管理员身份打开了一个命令提示符,然后运行了以下命令。

npm install -g @angular/cli@8.0.0 --unsafe-perm --force

最新更新