Running npm install --save-dev parcel in an npm project on my computer returns the following log:
npm WARN deprecated [email protected]: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm ERR! code 1
npm ERR! path /Users/xxxxxx/Desktop/test/node_modules/@parcel/watcher
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | x64
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: /Users/xxxxxx/anaconda3/bin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack File "<string>", line 1
npm ERR! gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack ^
npm ERR! gyp ERR! stack SyntaxError: invalid syntax
npm ERR! gyp ERR! stack
npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:422:12)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:514:28)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1105:16)
npm ERR! gyp ERR! stack at Socket.<anonymous> (node:internal/child_process:457:11)
npm ERR! gyp ERR! stack at Socket.emit (node:events:514:28)
npm ERR! gyp ERR! stack at Pipe.<anonymous> (node:net:337:12)
npm ERR! gyp ERR! System Darwin 22.5.0
npm ERR! gyp ERR! command "/Users/xxxxxx/.nvm/versions/node/v20.9.0/bin/node" "/Users/xxxxxx/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /Users/xxxxxx/Desktop/test/node_modules/@parcel/watcher
npm ERR! gyp ERR! node -v v20.9.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in: /Users/xxxxxx/.npm/_logs/2024-02-18T18_19_28_422Z-debug-0.log
Not sure how to resolve this. I've read it may be a problem with svgo, I was looking at node-gyp possible issues, but I'm still not sure how to fix this. Any help is much appreciated!
It seems like your nodeJs is missing some tools when installing the nodeJs.
Try to reinstall nodeJs and check the checkbox to install the necessary tools
Or you can use this command to install the necessary tools without reinstalling nodeJs. But the first solution is better