Npm i error: Error: Cannot find module '@nx/nx-darwin-arm64'

npm i get the error:

npm ERR! code 1
npm ERR! path Code/Babylon.js/node_modules/nx
npm ERR! command failed
npm ERR! command sh -c node ./bin/post-install
npm ERR! Code/Babylon.js/node_modules/nx/src/native/index.js:244
npm ERR!     throw loadError
npm ERR!     ^
npm ERR! 
npm ERR! Error: Cannot find module '@nx/nx-darwin-arm64'
npm ERR! Require stack:
npm ERR! - Code/Babylon.js/node_modules/nx/src/native/index.js
npm ERR! - Code/Babylon.js/node_modules/nx/src/hasher/node-task-hasher-impl.js
npm ERR! - Code/Babylon.js/node_modules/nx/src/hasher/task-hasher.js
npm ERR! - Code/Babylon.js/node_modules/nx/src/hasher/hash-task.js
npm ERR! - Code/Babylon.js/node_modules/nx/src/tasks-runner/run-command.js
npm ERR! - Code/Babylon.js/node_modules/nx/src/nx-cloud/utilities/get-cloud-options.js
npm ERR! - Code/Babylon.js/node_modules/nx/bin/post-install.js
npm ERR!     at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
npm ERR!     at Module._load (node:internal/modules/cjs/loader:922:27)
npm ERR!     at Module.require (node:internal/modules/cjs/loader:1143:19)
npm ERR!     at require (node:internal/modules/cjs/helpers:121:18)
npm ERR!     at Object.<anonymous> (Code/Babylon.js/node_modules/nx/src/native/index.js:135:29)
npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1256:14)
npm ERR!     at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
npm ERR!     at Module.load (node:internal/modules/cjs/loader:1119:32)
npm ERR!     at Module._load (node:internal/modules/cjs/loader:960:12)
npm ERR!     at Module.require (node:internal/modules/cjs/loader:1143:19) {
npm ERR!   code: 'MODULE_NOT_FOUND',
npm ERR!   requireStack: [
npm ERR!     'Code/Babylon.js/node_modules/nx/src/native/index.js',
npm ERR!     'Code/Babylon.js/node_modules/nx/src/hasher/node-task-hasher-impl.js',
npm ERR!     'Code/Babylon.js/node_modules/nx/src/hasher/task-hasher.js',
npm ERR!     'Code/Babylon.js/node_modules/nx/src/hasher/hash-task.js',
npm ERR!     'Code/Babylon.js/node_modules/nx/src/tasks-runner/run-command.js',
npm ERR!     'Code/Babylon.js/node_modules/nx/src/nx-cloud/utilities/get-cloud-options.js',
npm ERR!     'Code/Babylon.js/node_modules/nx/bin/post-install.js'
npm ERR!   ]
npm ERR! }
npm ERR! 
npm ERR! Node.js v18.17.1

npm ERR! A complete log of this run can be found in: .npm/_logs/2024-03-11T14_21_16_170Z-debug-0.log

I have tested node v18 and v20 on my M2 Mac. Both cannot work.

A new update was pushed to master just an hour or two ago that should fix this issue.

Pull from master, run npm install and let me know if that solved it. If it doesn’t - remove node_modules and run npm install (after pulling from master) - and will also be great to know if this one worked :slight_smile:

3 Likes

It worked. Big thanks.

1 Like

This error occurs again when I want to start this project on my another M2 Mac. :joy: :joy:

I reset my branch to an older commit, it worked. So I think maybe there is something wrong in the configurations.

And this is worth latest from master, a clean copy of the repo?
Can you run “npm install --optional” and see if it solved the issue?

Nop. I have tried again by doing clone from the lastet.

npm i, npm i --optional and npm install --omit=optional all didn’t work. :joy: :joy: :joy:

absolutely bananas.
Can you share your node and npm version? I want to run a few experiments.

Just FYI - of course, as a temporary solution, you can force-install the dependency it is requesting. It should not stop you from working, but it should, of course, work out of the box.

1 Like