意外重新安装后无法安装或运行Ionic

时间:2017-01-16 15:06:11

标签: ionic-framework

我安装了离子并正常运行。 无意中我安装了测试版

npm install ionic@beta

我没有让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 个答案:

答案 0 :(得分:1)

问题是因为当安装了没有管理员权限的beta版本时,它在用户范围内创建了PATH变量,该变量仅指向npm目录,并且此变量会覆盖系统PATH变量,因此CMD使用用户范围1,这会导致离子安装失败

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

相关问题