简体   繁体   English

ionic2 cordova安装错误-ENOENT

[英]ionic2 cordova installation error - ENOENT

I'm testing ionic2 and installed node, npm and cordova and it's been working fine. 我正在测试ionic2并安装了节点,npm和cordova,并且一切正常。 However, I couldn't install any npm package after I updated npm. 但是,更新npm后无法安装任何npm软件包。 So I removed all the node and npm related directories according to How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X) and reinstalled node-v6.9.1. 因此,根据如何完全卸载Node.js,并从头开始重新安装(Mac OS X)并重新安装了node-v6.9.1,我删除了所有与node和npm相关的目录。 But this time again, when I tried to install cordova using 'sudo npm install -g ionic cordova', it gives me an error: 但是这一次,当我尝试使用'sudo npm install -g ionic cordova'安装cordova时,它给了我一个错误:

$ rm -rf ~/.npm
$ npm cache clear
$ sudo npm install -g ionic cordova
npm WARN deprecated node-uuid@1.4.7: use uuid module instead
/usr/local/lib
└── ionic@2.1.12 

npm ERR! Darwin 16.1.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "ionic" "cordova"
npm ERR! node v6.9.1
npm ERR! npm  v3.10.8
npm ERR! path /usr/local/lib/node_modules/.staging/abbrev-ef9cc920
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename

npm ERR! enoent ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/abbrev-ef9cc920' -> '/usr/local/lib/node_modules/cordova/node_modules/npm/node_modules/abbrev'
npm ERR! enoent ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/abbrev-ef9cc920' -> '/usr/local/lib/node_modules/cordova/node_modules/npm/node_modules/abbrev'
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:

I've been searching Google and other question on Stackoverflow but could not solve the problem yet. 我一直在搜索Google和有关Stackoverflow的其他问题,但仍无法解决问题。 I'm using macOS Seira 10.12.1. 我正在使用macOS Seira 10.12.1。

Is this a npm bug or my fault? 这是npm错误还是我的错? Is there any possible solution to fix this issue? 有没有可能解决此问题的解决方案?

Thanks for your helping me. 感谢您的帮助。

I don't know exactly how to solve your issue. 我不知道该如何解决您的问题。 But just as a general recommendation. 但是,作为一般建议。 It is not a good idea to use sudo with npm install. 在npm install中使用sudo不是一个好主意。 Among other reasons, it could lead to installing malicious node packages that will be able to execute with root privileges on your machine. 除其他原因外,它可能导致安装恶意节点程序包,这些程序包将能够在您的计算机上以root特权执行。

Additionally, NVM (Node Version Manager) can assist with managing your node installations. 此外,NVM(节点版本管理器)可以协助您管理节点安装。 I recommend removing all your node and npm related directories again and following this guide with regards to installing node. 我建议再次删除所有与节点和npm相关的目录,并按照此指南安装节点。 Then try installing ionic again. 然后尝试再次安装ionic。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM