Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

amplify publish got error Error: Cannot find module '@rollup/rollup-darwin-x64' #14096

Open
fexpr opened this issue Jan 31, 2025 · 2 comments
Open
Labels
hosting Issues tied to hosting category pending-response Issue is pending response from the issue author pending-triage Issue is pending triage

Comments

@fexpr
Copy link

fexpr commented Jan 31, 2025

Environment information

0 verbose cli /usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npm-cli.js
1 info using [email protected]
2 info using [email protected]
3 silly config load:file:/usr/local/lib/node_modules/npm/npmrc
4 silly config load:file:/Users/wenyan/projects/testapp/.npmrc
5 silly config load:file:/Users/wenyan/.npmrc
6 silly config load:file:/Users/wenyan/.npm-global/etc/npmrc
7 verbose title npm exec ampx info
8 verbose argv "exec" "--" "ampx" "info"
9 verbose logfile logs-max:10 dir:/Users/wenyan/.npm/_logs/2025-01-31T04_54_26_990Z-
10 verbose logfile /Users/wenyan/.npm/_logs/2025-01-31T04_54_26_990Z-debug-0.log
11 silly logfile start cleaning logs, removing 1 files
12 silly logfile done cleaning log files
13 silly packumentCache heap:4345298944 maxSize:1086324736 maxEntrySize:543162368
14 http fetch GET 200 https://registry.npmjs.org/ampx 450ms (cache miss)
15 verbose stack Error: could not determine executable to run
15 verbose stack     at getBinFromManifest (/usr/local/lib/node_modules/npm/node_modules/libnpmexec/lib/get-bin-from-manifest.js:17:23)
15 verbose stack     at exec (/usr/local/lib/node_modules/npm/node_modules/libnpmexec/lib/index.js:202:15)
15 verbose stack     at async Npm.exec (/usr/local/lib/node_modules/npm/lib/npm.js:207:9)
15 verbose stack     at async module.exports (/usr/local/lib/node_modules/npm/lib/cli/entry.js:74:5)
16 verbose pkgid [email protected]
17 error could not determine executable to run
18 verbose cwd /Users/wenyan/projects/testapp
19 verbose os Darwin 23.6.0
20 verbose node v22.12.0
21 verbose npm  v10.9.0
22 verbose exit 1
23 verbose code 1
24 error A complete log of this run can be found in: /Users/wenyan/.npm/_logs/2025-01-31T04_54_26_990Z-debug-0.log
~

Describe the bug

run amplify publish got above error, tried rm -rf node_modules, and package-lock.json, and use yarn install, still got the same error.

Reproduction steps

testapp % amplify publish
✔ Successfully pulled backend environment dev from the cloud.

Current Environment: dev

┌──────────┬─────────────────┬───────────┬───────────────────┐
│ Category │ Resource name │ Operation │ Provider plugin │
├──────────┼─────────────────┼───────────┼───────────────────┤
│ Hosting │ S3AndCloudFront │ No Change │ awscloudformation │
└──────────┴─────────────────┴───────────┴───────────────────┘

No changes detected

? Do you still want to publish the frontend? Yes

[email protected] build
vite build

/Users/wenyan/projects/testapp/node_modules/rollup/dist/native.js:64
throw new Error(
^

Error: Cannot find module @rollup/rollup-darwin-x64. npm has a bug related to optional dependencies (npm/cli#4828). Please try npm i again after removing both package-lock.json and node_modules directory.
at requireWithFriendlyError (/Users/wenyan/projects/testapp/node_modules/rollup/dist/native.js:64:9)
at Object. (/Users/wenyan/projects/testapp/node_modules/rollup/dist/native.js:73:76)
at Module._compile (node:internal/modules/cjs/loader:1565:14)
at Object..js (node:internal/modules/cjs/loader:1708:10)
at Module.load (node:internal/modules/cjs/loader:1318:32)
at Function._load (node:internal/modules/cjs/loader:1128:12)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:219:24)
at cjsLoader (node:internal/modules/esm/translators:263:5)
at ModuleWrap. (node:internal/modules/esm/translators:196:7) {
[cause]: Error: Cannot find module '@rollup/rollup-darwin-x64'
Require stack:

  • /Users/wenyan/projects/testapp/node_modules/rollup/dist/native.js
    at Function._resolveFilename (node:internal/modules/cjs/loader:1249:15)
    at Function._load (node:internal/modules/cjs/loader:1075:27)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:219:24)
    at Module.require (node:internal/modules/cjs/loader:1340:12)
    at require (node:internal/modules/helpers:138:16)
    at requireWithFriendlyError (/Users/wenyan/projects/testapp/node_modules/rollup/dist/native.js:46:10)
    at Object. (/Users/wenyan/projects/testapp/node_modules/rollup/dist/native.js:73:76)
    at Module._compile (node:internal/modules/cjs/loader:1565:14)
    at Object..js (node:internal/modules/cjs/loader:1708:10) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    '/Users/wenyan/projects/testapp/node_modules/rollup/dist/native.js'
    ]
    }
    }
@fexpr fexpr added the pending-triage Issue is pending triage label Jan 31, 2025
@ykethan
Copy link
Member

ykethan commented Feb 3, 2025

Hey,👋 thanks for raising this! I'm going to transfer this over to our CLI repo as this appears to be a Gen 1 issue.

@ykethan ykethan transferred this issue from aws-amplify/amplify-backend Feb 3, 2025
@ykethan
Copy link
Member

ykethan commented Feb 3, 2025

@fexpr when running vite build locally does this error also occur?
I was able to find the following similar issues
https://stackoverflow.com/questions/77583341/cannot-find-module-rollup-rollup-win32-x64-msvc-npm-has-a-bug-related-to-optio
https://answers.netlify.com/t/react-vite-build-fails-because-of-rollup-rollup-linux-x64-gnu/107504/2
https://sandipdulal.medium.com/fixing-vite-build-error-on-linux-and-windows-using-docker-error-cannot-find-module-e73bb2fb479d

from the similar issues and suggestion could you try adding the module as a optional dependency and then retry the publish command.

@ykethan ykethan added hosting Issues tied to hosting category pending-response Issue is pending response from the issue author labels Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hosting Issues tied to hosting category pending-response Issue is pending response from the issue author pending-triage Issue is pending triage
Projects
None yet
Development

No branches or pull requests

2 participants