js-a11y-workshop
js-a11y-workshop copied to clipboard
Cannot run npm install
I tried to remove package-lock.json, do npm install --force and npm install --legacy-peer-deps, but still could not get the node_modules. :(
OS: Windows 10 Npm: 7.18.1 Node: 16.3.0
Here is my log file if it helps:
14953 verbose stack Error: command failed
14953 verbose stack at ChildProcess.<anonymous> (C:\Users\alin.ciocan\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\promise-spawn\index.js:64:27)
14953 verbose stack at ChildProcess.emit (node:events:394:28)
14953 verbose stack at maybeClose (node:internal/child_process:1067:16)
14953 verbose stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
14954 verbose pkgid [email protected]
14955 verbose cwd C:\Users\alin.ciocan\Desktop\js-a11y-workshop-master
14956 verbose Windows_NT 10.0.19043
14957 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\alin.ciocan\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "i" "--force"
14958 verbose node v16.3.0
14959 verbose npm v7.18.1
14960 error code 1
14961 error path C:\Users\alin.ciocan\Desktop\js-a11y-workshop-master\node_modules\sharp
14962 error command failed
14963 error command C:\Windows\system32\cmd.exe /d /s /c (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
14964 error info sharp Using cached C:\Users\alin.ciocan\AppData\Local\npm-cache\_libvips\libvips-8.7.4-win32-x64.tar.gz
14964 error info sharp Creating C:\Users\alin.ciocan\Desktop\js-a11y-workshop-master\node_modules\sharp\build\Release
14964 error info sharp Copying DLLs from C:\Users\alin.ciocan\Desktop\js-a11y-workshop-master\node_modules\sharp\vendor\lib to C:\Users\alin.ciocan\Desktop\js-a11y-workshop-master\node_modules\sharp\build\Release
14964 error gyp info it worked if it ends with ok
14964 error gyp info using [email protected]
14964 error gyp info using [email protected] | win32 | x64
14964 error gyp ERR! configure error
14964 error gyp ERR! stack Error: Command failed: C:\Python39\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
14964 error gyp ERR! stack File "<string>", line 1
14964 error gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
14964 error gyp ERR! stack ^
14964 error gyp ERR! stack SyntaxError: invalid syntax
14964 error gyp ERR! stack
14964 error gyp ERR! stack at ChildProcess.exithandler (node:child_process:326:12)
14964 error gyp ERR! stack at ChildProcess.emit (node:events:394:28)
14964 error gyp ERR! stack at maybeClose (node:internal/child_process:1067:16)
14964 error gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
14964 error gyp ERR! System Windows_NT 10.0.19043
14964 error gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\alin.ciocan\\Desktop\\js-a11y-workshop-master\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
14964 error gyp ERR! cwd C:\Users\alin.ciocan\Desktop\js-a11y-workshop-master\node_modules\sharp
14964 error gyp ERR! node -v v16.3.0
14964 error gyp ERR! node-gyp -v v3.8.0
14964 error gyp ERR! not ok
14965 verbose exit 1
Sharp strikes again! Thanks for providing the stack trace. I searched and found a thread that looks very similar: https://stackoverflow.com/questions/57217251/getting-gyp-err-stack-syntaxerror-invalid-syntax-while-executing-npm-insta?noredirect=1&lq=1
The OP said they resolved it by installing a specific version of Python 2. 🤷🏻♀️ What version of Python is running on your machine?
Actually this error got resolved after installing Python 2 (exact version - 2.7.15) and pointing the environment variable PYTHON to C:\Python27\python.exe
You are right, I have Python version 3.9.4
I have installed also Python 2.7.15 and then run npm install --force, however I got the same error, because the npm still uses the Python3.

Environment variables:

Npm error (using Python3):

@AlinCiocan Try an earlier version of node. I've seen these issues, and switching to node 14 has fixed everything for me.
I ran into npm install issues as well on an M1 Mac. Using Node 14 did the trick, but in order to install it, I had to run nvm install 14 with Rosetta.
Tried an earlier version of node, switching to node 14. Still no progress and cant use the course materials to progress.