求助~鸿蒙系统windows环境搭建(hpm-cli安装失败)!
系统win10,执行命令“npm install -g @ohos/hpm-cli”,报错如下:
npm ERR! code EEXIST
npm ERR! path C:\Users\jay\AppData\Roaming\npm\node_modules\@ohos\hpm-cli\bin\hpm
npm ERR! dest C:\Users\jay\AppData\Roaming\npm\hpm
npm ERR! EEXIST: file already exists, cmd shim 'C:\Users\jay\AppData\Roaming\npm\node_modules\@ohos\hpm-cli\bin\hpm' -> 'C:\Users\jay\AppData\Roaming\npm\hpm'
npm ERR! File exists: C:\Users\jay\AppData\Roaming\npm\hpm
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jay\AppData\Roaming\npm-cache\_logs\2020-10-21T13_50_56_526Z-debug.log
The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command npm install -g @ohos/hpm-cli" terminated with exit code: 1.
太困难了,终于安装成功了。
原因:
1.官方提供的网址连接超时,更换为阿里源npm config set registry https://registry.npm.taobao.org;
2.本地可能存在旧版本hpm,按提示删除已存在的hpm,再执行npm install -g @ohos/hpm-cli;
3.安装成功,hpm -V会显示版本号;