在Ubuntu 16.04中安装ionic时出错

时间:2017-02-22 15:19:52

标签: node.js cordova ionic-framework

我已经安装了cordova,现在当我运行npm install -g ionic时出现以下错误

npm ERR! Linux 4.4.0-64-generic
npm ERR! argv "/home/daniel/.nvm/versions/node/v6.2.2/bin/node" "/home/daniel/.nvm/versions/node/v6.2.2/bin/npm" "install" "-g" "ionic"
npm ERR! node v6.2.2
npm ERR! npm  v3.9.5
npm ERR! path /home/daniel/.nvm/versions/node/v6.2.2/lib/node_modules/.staging/ansi-e973c662
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename

npm ERR! enoent ENOENT: no such file or directory, rename '/home/daniel/.nvm/versions/node/v6.2.2/lib/node_modules/.staging/ansi-e973c662' -> '/home/daniel/.nvm/versions/node/v6.2.2/lib/node_modules/ionic/node_modules/cordova-lib/node_modules/ansi'
npm ERR! enoent ENOENT: no such file or directory, rename '/home/daniel/.nvm/versions/node/v6.2.2/lib/node_modules/.staging/ansi-e973c662' -> '/home/daniel/.nvm/versions/node/v6.2.2/lib/node_modules/ionic/node_modules/cordova-lib/node_modules/ansi'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! Please include the following file with any support request:
npm ERR!     /home/daniel/npm-debug.log
npm ERR! code 1

我怎样才能克服它?

由于

1 个答案:

答案 0 :(得分:2)

以下是解决它的命令:

sudo npm install npm@latest -g
sudo npm uninstall ionic -g
sudo npm uninstall cordova -g
sudo npm cache clean
sudo npm install -g ionic cordova

参考文献:

  1. https://github.com/npm/npm/issues/11265
  2. https://docs.npmjs.com/getting-started/installing-node