stoically / temporary-containers

Firefox Add-on that lets you open automatically managed disposable containers
https://addons.mozilla.org/firefox/addon/temporary-containers/
MIT License
846 stars 57 forks source link

`npm install` fails #623

Closed MahdiNazemi closed 1 year ago

MahdiNazemi commented 1 year ago

I am working on a feature that will address #399.

After forking the extension and running npm install, I get the following error:

npm ERR! code 7
npm ERR! path /Users/mahdi/Documents/temporary-containers/node_modules/@parcel/watcher
npm ERR! command failed
npm ERR! command sh -c prebuild-install -r napi || node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@6.1.0
npm ERR! gyp info using node@19.8.1 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.11.2 found at "/opt/homebrew/opt/python@3.11/bin/python3.11"
npm ERR! gyp ERR! UNCAUGHT EXCEPTION
npm ERR! gyp ERR! stack TypeError: Cannot assign to read only property 'cflags' of object '#'
npm ERR! gyp ERR! stack     at createConfigFile (/Users/mahdi/Documents/temporary-containers/node_modules/node-gyp/lib/configure.js:118:21)
npm ERR! gyp ERR! stack     at /Users/mahdi/Documents/temporary-containers/node_modules/node-gyp/lib/configure.js:85:9
npm ERR! gyp ERR! stack     at /Users/mahdi/Documents/temporary-containers/node_modules/mkdirp/index.js:30:20
npm ERR! gyp ERR! stack     at FSReqCallback.oncomplete (node:fs:185:23)
npm ERR! gyp ERR! System Darwin 22.3.0
npm ERR! gyp ERR! command "/opt/homebrew/Cellar/node/19.8.1/bin/node" "/Users/mahdi/Documents/temporary-containers/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /Users/mahdi/Documents/temporary-containers/node_modules/@parcel/watcher
npm ERR! gyp ERR! node -v v19.8.1
npm ERR! gyp ERR! node-gyp -v v6.1.0
npm ERR! gyp ERR! This is a bug in `node-gyp`.
npm ERR! gyp ERR! Try to update node-gyp and file an Issue if it does not help:
npm ERR! gyp ERR!

I have node@19.8.1 installed on an M1 Mac.

I added "node-gyp": "^9.3.1", to devDependencies, but that creates other problems.

I updated the node-gyp version that is bundled with npm as explained here, but that did not solve the issue either. Both node-gyp --version and /opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js --version return 9.3.1. Even after the update, I still see the following line

npm ERR! gyp info using node-gyp@6.1.0

I was wondering if anyone else has faced a similar problem and knows how to resolve it. Thanks!

MahdiNazemi commented 1 year ago

Adding "node-gyp": "^9.3.1", or "parcel": "^2.8.3", resolves the issue on a first call to npm install, but shows errors if npm install is called again.

Conduitry commented 1 year ago

I was able to install dependencies and build a seemingly working copy of the extension by first downgrading to Node 14. I'm on Ubuntu 22.04, if that matters.

I also tried Node 16 and 18, and I got a different error message about make not being found (I'm guessing because prebuilt versions didn't exist for that Node and gyp version combination and so it was trying to compile something). If your system is set up to be able to compile the necessary things, Node 16 or 18 might also work for you.