y***@icloud.com
y***@icloud.com
  • 发布:2024-05-14 10:01
  • 更新:2024-10-03 09:35
  • 阅读:1901

Cannot find module @rollup/rollup-darwin-x64

分类:HBuilder

安卓 app 云打包时,出现这个错误,如何解决?

HBuilder] 09:54:20.116 Error: Cannot find module @rollup/rollup-darwin-x64. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try npm i again after removing both package-lock.json and node_modules directory.
[HBuilder] 09:54:20.122 at requireWithFriendlyError (/Users/mac/Library/CloudStorage/OneDrive-个人/学习/移动端开发/uniapp/安卓编译测试/fofDebug/DebugCode/安卓编译测试/node_modules/rollup/dist/native.js:59:9)
[HBuilder] 09:54:20.129 at Object.<anonymous> (/Users/mac/Library/CloudStorage/OneDrive-个人/学习/移动端开发/uniapp/安卓编译测试/fofDebug/DebugCode/安卓编译测试/node_modules/rollup/dist/native.js:68:76)
[HBuilder] 09:54:20.133 ... 2 lines matching cause stack trace ...
[HBuilder] 09:54:20.137 at Module.load (node:internal/modules/cjs/loader:1203:32)
[HBuilder] 09:54:20.141 at Module._load (node:internal/modules/cjs/loader:1019:12)
[HBuilder] 09:54:20.144 at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:203:29)
[HBuilder] 09:54:20.148 at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
[HBuilder] 09:54:20.152 at async ModuleLoader.import (node:internal/modules/esm/loader:337:24)
[HBuilder] 09:54:20.155 at async importModuleDynamicallyWrapper (node:internal/vm/module:432:15) {
[HBuilder] 09:54:20.159 [cause]: Error: Cannot find module '@rollup/rollup-darwin-x64'
[HBuilder] 09:54:20.161 Require stack:
[HBuilder] 09:54:20.162 - /Users/mac/Library/CloudStorage/OneDrive-个人/学习/移动端开发/uniapp/安卓编译测试/fofDebug/DebugCode/安卓编译测试/node_modules/rollup/dist/native.js
[HBuilder] 09:54:20.166 at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
[HBuilder] 09:54:20.169 at Module._resolveFilename (/Users/mac/Library/CloudStorage/OneDrive-个人/学习/移动端开发/uniapp/安卓编译测试/fofDebug/DebugCode/安卓编译测试/node_modules/module-alias/index.js:49:29)
[HBuilder] 09:54:20.173 at Module._load (node:internal/modules/cjs/loader:981:27)
[HBuilder] 09:54:20.176 at Module.require (node:internal/modules/cjs/loader:1231:19)
[HBuilder] 09:54:20.179 at require (node:internal/modules/helpers:177:18)
[HBuilder] 09:54:20.183 at requireWithFriendlyError (/Users/mac/Library/CloudStorage/OneDrive-个人/学习/移动端开发/uniapp/安卓编译测试/fofDebug/DebugCode/安卓编译测试/node_modules/rollup/dist/native.js:41:10)
[HBuilder] 09:54:20.187 at Object.<anonymous> (/Users/mac/Library/CloudStorage/OneDrive-个人/学习/移动端开发/uniapp/安卓编译测试/fofDebug/DebugCode/安卓编译测试/node_modules/rollup/dist/native.js:68:76)
[HBuilder] 09:54:20.191 at Module._compile (node:internal/modules/cjs/loader:1364:14)
[HBuilder] 09:54:20.194 at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
[HBuilder] 09:54:20.198 at Module.load (node:internal/modules/cjs/loader:1203:32) {
[HBuilder] 09:54:20.201 code: 'MODULE_NOT_FOUND',
[HBuilder] 09:54:20.202 requireStack: [
[HBuilder] 09:54:20.205 '/Users/mac/Library/CloudStorage/OneDrive-个人/学习/移动端开发/uniapp/安卓编译测试/fofDebug/DebugCode/安卓编译测试/node_modules/rollup/dist/native.js'
[HBuilder] 09:54:20.209 ]
[HBuilder] 09:54:20.212 }
[HBuilder] 09:54:20.215 }
[HBuilder] 09:54:20.219 Build failed with errors.

2024-05-14 10:01 负责人:无 分享
已邀请:
lexang

lexang

我也遇到了这个问题

lexang

lexang

运行到浏览器 或者 运行npm run dev:h5 然后点网址 就报错:
Error: Cannot find module @rollup/rollup-darwin-x

  1. npm has a bug related to optional dependencies
    (https://github
    .com/npm/cli/issues/4828). Please try npm i again after removing bo
    th package-lock.json and node modules directory.
z***@163.com

z***@163.com

一样的问题,是在 macos 上通过 vue3 cli 创建的项目吧

  • 超级无敌APP

    是的,我也这样,我刚更新的hbuilder,

    2024-05-24 16:06

  • 1***@qq.com

    回复 o***@icloud.com: 你解决了吗?

    2024-07-07 23:20

2***@qq.com

2***@qq.com

一样的问题,没有解决办法

  • 1***@qq.com

    大哥 这问题解决了吗

    2024-07-07 23:20

1***@qq.com

1***@qq.com

我没问题(MacBook Pro M1),可以按照我的做法尝试一下。

在vscode或者使用cli执行build命令成功后后提示:
DONE Build complete.Run method: open HBuilderX, import dist/build/app run.

使用hubilder打开dist/build/app目录,一定要打开app目录,再执行云打包。

1***@qq.com

1***@qq.com

这咋解决丫

舌尖跳舞

舌尖跳舞 - 现在不减肥,以后徒伤悲。

在package.json里添加

 "@rollup/rollup-darwin-x64": "4.20.0",

重新安装依赖

SKYS

SKYS

有解决了的吗?我的还不行

要回复问题请先登录注册