2017-01-16 120 views
0

我已安装离子并正常运行。 一不留神我安装了beta版意外重新安装后无法安装或运行Ionic

npm install [email protected] 

我这样做,而不必用CMD管理员身份运行,没有被再确认,离子命令后,所以我试图重新安装离子,但没有运气,我试图卸载它,然后再次而且安装它没有运气,我得到的错误,当我安装它:

npm ERR! Windows_NT 10.0.10586 
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\{user}\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "ionic" 
npm ERR! node v6.9.4 
npm ERR! npm v4.1.1 
npm ERR! path C:\Users\{user}\AppData\Roaming\npm\node_modules\.staging\ansi-313f575d 
npm ERR! code ENOENT 
npm ERR! errno -4058 
npm ERR! syscall rename 

npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\{user}\AppData\Roaming\npm\node_modules\.staging\ansi-313f575d' -> 'C:\Users\{user}\AppData\Roaming\npm\node_modules\ionic\node_modules\cordova-lib\node_modules\ansi' 
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\{user}\AppData\Roaming\npm\node_modules\.staging\ansi-313f575d' -> 'C:\Users\{user}\AppData\Roaming\npm\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. 

回答

1

的问题是,因为没有管理员权限,安装后测试版本,它创建了用户范围PATH变量指向只有NPM目录,而这个变量覆盖了系统PATH变量,所以CMD使用了用户范围一,导致离子安装失败。

删除用户的范围PATH变量并重新安装离子修复了问题。