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

Cross platform build fails #15120

Closed
7 tasks done
marcuslindfeldt opened this issue Nov 23, 2023 · 2 comments
Closed
7 tasks done

Cross platform build fails #15120

marcuslindfeldt opened this issue Nov 23, 2023 · 2 comments

Comments

@marcuslindfeldt
Copy link

Describe the bug

package-lock was generated on a mac m1 which led to the following package to be installed

└─┬ vite@5.0.2
  └─┬ rollup@4.4.1
    └── @rollup/rollup-darwin-arm64@4.4.1

when building in CI on a linux machine we get the following error

> tsc && vite build

node:internal/modules/cjs/loader:1144
  const err = new Error(message);
              ^

Error: Cannot find module '@rollup/rollup-linux-x64-gnu'
Require stack:
- /home/vsts/work/1/s/ui/node_modules/vite/node_modules/rollup/dist/native.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/home/vsts/work/1/s/ui/node_modules/vite/node_modules/rollup/dist/native.js:49:48)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at cjsLoader (node:internal/modules/esm/translators:345:17) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/vsts/work/1/s/ui/node_modules/vite/node_modules/rollup/dist/native.js'
  ]
}

Reproduction

impossible to reproduce using vite.new

Steps to reproduce

  • run npm install on another os (e.g. mac) to generate a lockfile
  • switch os to e.g. linux, checkout and run npm install and then npm run build

System Info

System:
    OS: macOS 14.1.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 2.09 GB / 64.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 20.9.0 - ~/.nvm/versions/node/v20.9.0/bin/node
    npm: 10.1.0 - ~/.nvm/versions/node/v20.9.0/bin/npm
  Browsers:
    Chrome: 119.0.6045.159
    Safari: 17.1
  npmPackages:
    @vitejs/plugin-react: ^4.2.0 => 4.2.0
    vite: ^5.0.2 => 5.0.2

Used Package Manager

npm

Logs

No response

Validations

@sapphi-red
Copy link
Member

@marcuslindfeldt I think you are facing this bug in npm: npm/cli#4828
I guess running npm i after removing both `package-lock.json and node_modules directory would work.

@marcuslindfeldt
Copy link
Author

@sapphi-red That did the trick! And thank you for the PR in the rollup project to help notify users about this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants