HarmonyOS鸿蒙Next中build init失败hvigor ERROR: 00308002 Operation Error
HarmonyOS鸿蒙Next中build init失败hvigor ERROR: 00308002 Operation Error
"D:\Program Files\Huawei\DevEco Studio\tools\node\node.exe" "D:\Program Files\Huawei\DevEco Studio\tools\hvigor\bin\hvigorw.js" --sync -p product=default --analyze=normal --parallel --incremental --no-daemon
Installing pnpm@8.13.1...
npm warn cli npm v11.2.0 does not support Node.js v18.20.1. This version of npm supports the following node versions: `^20.17.0 || >=22.9.0`. You can find the latest version at https://nodejs.org/.
npm warn Unknown env config "auto-install-peers". This will stop working in the next major version of npm.
npm error code EPERM
npm error syscall open
npm error path D:\Program Files\nodejs\node_cache\_cacache\tmp\bb279696
npm error errno EPERM
npm error FetchError: Invalid response body while trying to fetch https://repo.huaweicloud.com/repository/npm/pnpm:: EPERM: operation not permitted, open 'D:\Program Files\nodejs\node_cache\_cacache\tmp\bb279696'
npm error at D:\Program Files\nodejs\node_global\node_modules\npm\node_modules\minipass-fetch\lib\body.js:170:15
npm error at async Response.json (D:\Program Files\nodejs\node_global\node_modules\npm\node_modules\minipass-fetch\lib\body.js:75:17)
npm error at async RegistryFetcher.packument (D:\Program Files\nodejs\node_global\node_modules\npm\node_modules\pacote\lib\registry.js:98:25)
npm error at async RegistryFetcher.manifest (D:\Program Files\nodejs\node_global\node_modules\npm\node_modules\pacote\lib\registry.js:128:23)
npm error at async #fetchManifest (D:\Program Files\nodejs\node_global\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1202:20)
npm error at async #nodeFromEdge (D:\Program Files\nodejs\node_global\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1040:19)
npm error at async #buildDepStep (D:\Program Files\nodejs\node_global\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:904:11)
npm error at async Arborist.buildIdealTree (D:\Program Files\nodejs\node_global\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:181:7)
npm error at async Promise.all (index 1)
npm error at async Arborist.reify (D:\Program Files\nodejs\node_global\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:131:5) {
npm error code: 'EPERM',
npm error errno: 'EPERM',
npm error syscall: 'open',
npm error path: 'D:\\Program Files\\nodejs\\node_cache\\_cacache\\tmp\\bb279696',
npm error type: 'system',
npm error requiredBy: '.'
}
npm error
npm error The operation was rejected by your operating system.
npm error It's possible that the file was already in use (by a text editor or antivirus),
npm error or that you lack permissions to access it.
npm error
npm error If you believe this might be a permissions issue, please double-check the
npm error permissions of the file and its containing directories, or try running
npm error the command again as root/Administrator.
npm error Log files were not written due to an error writing to the directory: D:\Program Files\nodejs\node_cache\_logs
npm error You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
> hvigor ERROR: 00308002 Operation Error
Error Message: D:\Program Files\Huawei\DevEco Studio\tools\node\npm.cmd install,pnpm execute failed.
* Try the following:
> Space is not supported in HVIGOR_USER_HOME. Remove the space in HVIGOR_USER_HOME to fix the issue.
Process finished with exit code -1
更多关于HarmonyOS鸿蒙Next中build init失败hvigor ERROR: 00308002 Operation Error的实战教程也可以访问 https://www.itying.com/category-93-b0.html
4 回复
你好:
问题根因是npm版本太低,删除高版本node,执行npm install -g npm@版本号,再删除低版本node,安装高版本node。可以解决问题。
更多关于HarmonyOS鸿蒙Next中build init失败hvigor ERROR: 00308002 Operation Error的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html
不支持npm,
基本信息
- 项目名称: 示例项目
- 作者: 张三
- 版本: 1.0.0
描述:
这是一个示例项目,用于演示如何将HTML内容转换为Markdown格式。
鸿蒙Next中build init失败错误00308002通常是由于项目配置或环境问题导致。检查以下方面:
- 确保DevEco Studio为最新版本
- 验证项目目录结构完整,无缺失文件
- 确认node.js版本符合要求(建议14.19.1+)
- 检查网络连接正常,能够访问华为仓库
- 清理缓存后重试:删除项目下的build、.hvigor、node_modules目录,
从错误日志来看,主要存在以下几个问题:
- Node.js版本不兼容问题:
- 当前使用的是Node.js v18.20.1,但npm v11.2.0要求Node.js版本为^20.17.0 || >=22.9.0
- 建议升级Node.js到v20.x或v22.x版本
- 权限问题(EPERM错误):
- 系统拒绝了对node_cache目录的访问权限
- 可能是由于防病毒软件锁定文件或目录权限不足导致
- 路径问题:
- 错误提示HVIGOR_USER_HOME路径中包含空格
- 建议将项目放在不含空格的路径中
解决方案:
- 升级Node.js到兼容版本
- 以管理员身份运行DevEco Studio
- 检查防病毒软件设置,临时禁用后重试
- 将项目移动到不含空格的路径(如D:\HarmonyOSProjects)
- 清理npm缓存(npm cache clean --force)
这些操作应该能解决00308002 Operation Error问题。