无法安装angular-cli

时间:2016-11-11 10:48:34

标签: angularjs angular npm angular-cli

angular-cli只是在安装过程中退出:

(myapp)vagrant@myapp-local:/vagrant$ sudo npm install -g angular-cli
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated lodash-node@2.4.1: This package is discontinued. Use lodash@^4.0.0.
(myapp)vagrant@myapp-local:/vagrant$ l mapToRegistry uri https://registry.npmjs.org/serve-static

(myapp)vagrant@myapp-local:/vagrant$ ng
The program 'ng' is currently not installed. To run 'ng' please ask your administrator to install the package 'ng-common'

我似乎有节点和npm的最新版本:

(myapp)vagrant@myapp-local:/vagrant$ npm -v
3.10.9
(myapp)vagrant@myapp-local:/vagrant$ node -v
v6.9.1

2 个答案:

答案 0 :(得分:3)

已解决:所以问题是流浪汉机器的记忆我增加了它并且它起作用了。

config.vm.provider "virtualbox" do |vb|
    vb.memory = "2048"
end

最后一步我必须这样做:

sudo ln -s   /home/vagrant/node-v6.9.1-linux-x64/lib/node_modules/angular-cli/bin/ng /usr/bin/ng

答案 1 :(得分:0)

问题在于需要NPM3。目前没有在自述文件中提及此link。只需执行npm install -g npm3,然后使用npm3代替npm安装或只更新npm到最新版本。希望这会奏效。

更新

  1. 尝试清理缓存 - npm cache clean
  2. 卸载angular-cli - npm uninstall -g angular-cli
  3. 再次安装npm install -g angular-cli
  4. 更糟糕的情况是使用angualr cli这样的-force标志安装npm install -g -f angular-cli - max-width:100%; white-space:nowrap;