2017-06-02 99 views
0

我在AWS上有一个Ubuntu实例,我使用伪造来设置服务器。 我已经安装了包nodejs和npm。 为了解决在Ubuntu上安装全球包我按照本教程中提到的第二个解决方案的问题, https://docs.npmjs.com/getting-started/fixing-npm-permissions在Ubuntu服务器上从npm安装@ angular/cli

现在,当我尝试使用这个命令来安装,

NPM安装-g @angular/CLI

我碰到下面的错误,

[email protected]:~/frontend/current$ npm install -g @angular/cli 

▐╢░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟ WARN引擎@ angular/cli @ 1.1.0:wanted:{“node”:“> = 6.9.0”,“npm”:“> = 3.0.0”}(current:{“node”:“4.2.6”,“npm”:“ 3.5.2“}) loadDep:node-sass→heade▌███████████████████████░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░ loadDep:node-sass→resol████████████████████████░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░╟ loadDep:node-sass→mapTo▀█████████████████ ██████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟ loadDep:节点-sass→在████████████████████████之后░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░╟ loadDep:@ ngtools/json-sch████████████████ █████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟ loadDep :yargs→200▌██████████████████████████████████████████░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░ ░░░░░░░░░╟ /home/forge/.npm-global/bin/ng - > /home/forge/.npm-global/lib/node_modules/@angular/cli/bin/ng

[email protected]安装/home/forge/.npm-global/lib/node_modules/@angular/cli/node_modules/node-sass 节点脚本/ install.js

SH :1:节点:未找到 npm WARN安装:[email protected] [email protected]安装:node scripts/install.js npm WARN安装:[email protected]产卵ENOENT /home/forge /。 npm-global/lib └─┬@a ngular/[email protected] └──未满足可选依赖[email protected]^4.3.0

NPM WARN可选跳跃失败可选依赖/ @角/ CLI/chokidar/fsevents: NPM WARN notsup不兼容您的操作系统或体系结构:[email protected]

+1

清除所有相关的node_modules,cache,appdata,然后重新安装nodejs。以“sudo”用户身份登录。使用命令'sudo npm install ...' – Aravind

回答

0

运行下面的命令

sudo apt-get uninstall nodejs 

sudo apt-get install python-software-properties 
$ curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash - 

sudo apt-get install nodejs 

现在,使用检查点/ NPM版本

node -v 
npm -v 

然后尝试安装CLI。

+1

'sudo apt-get卸载nodejs'返回'E:无效的操作卸载',正确的命令是我想''sudo apt-get --purge remove nodejs' – Padhraic

0

我们可以使用纱包管理器。它的快速,简单,易懂(有意义)。您可以:

  1. 安装纱

    NPM安装纱-g

  2. 使用纱安装角CLI

yarn global add angular-cli

完成这就是它,它的工作为了我。

0

我有一个类似的问题这一点,问题是由我的版本节点安装的4.7.2,而不是新的6.x的版本as per this question引起的。所以我安装了angular-cli而不是this answer suggested

如果您已经安装@angular/cli,你需要NodeJS更高 6.9.7,连同NPM 或更高。

如果您已经安装angular-cli,则需要更高的NodeJS4.4.x到,连同NPM 或更高。

欲了解更多信息,请参阅上面的链接并阅读必备条件。