@ angular / cli @ 8.3.19安装后脚本失败

时间:2019-11-26 00:16:40

标签: node.js angular npm

嗨,我无法使用npm install -g @angular/cli@8.3.19安装angular cli。 我不断得到这个:

> node ./bin/postinstall/script.js

module.js:549
    throw err;
    ^

Error: Cannot find module '/root/.nvm/versions/node/v13.0.1/lib/node_modules/@angular/cli/bin/postinstall/script.js'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @angular/cli@8.3.19 postinstall: `node ./bin/postinstall/script.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @angular/cli@8.3.19 postinstall 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!     /root/.npm/_logs/2019-11-26T00_10_33_515Z-debug.log

节点版本:13.0.1
Npm版本:6.13.1
Ubuntu版本:18.04.2

我也尝试不指定CLI版本。

3 个答案:

答案 0 :(得分:0)

尝试与sudo npm一起运行。在Ubuntu上,您需要以root权限运行。这取决于您如何安装节点。

sudo npm install -g @angular/cli@8.3.19

另一方面,尝试安装节点12和LTS版本以具有更安全的版本。

希望有帮助

答案 1 :(得分:0)

我尝试使用在网上找到的命令:

Failure/Error: super

     NoMethodError:
       undefined method `search' for #<RSpec::ExampleGroups::***Controller:::Get::success:0x00007fa50f7de068>

它奏效了。

答案 2 :(得分:0)

&&npm cache clean然后npm cache verify之前尝试清理npm缓存