Skip to content
Advertisement

npm install failing due to Python executable – React Template

Good day

I have purchased a React template that I am trying to get up and running locally. When I run an ‘npm i’ command, I get the following error message:

gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python C:Python39python.EXE
gyp ERR! configure error 
gyp ERR! stack Error: Command failed: C:Python39python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                       ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:383:12)
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at maybeClose (internal/child_process.js:1058:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:293:5)
gyp ERR! System Windows_NT 10.0.19044
gyp ERR! command "C:\Program Files\nodejs\node.exe" "D:\Projects\Mondo\Molo Product Managment\Code\template\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd D:ProjectsMondoMolo Product ManagmentCodetemplatenode_modulesnode-sass
gyp ERR! node -v v14.18.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

I have installed the latest version of Python from here: https://www.python.org/downloads/

And have updated my environment variables (both the ‘User variables’ as well as the ‘System Variables”) to include the path that it was installed to: enter image description here enter image description here enter image description here

I would be extremely grateful if anyone might have some advice on why this is failing, and what I might be doing wrong.

Advertisement

Answer

Thank you for everyone’s suggestions. I have been able to resolve my build failure through a combination form the advice gained from the links provided. Here follows the steps I implemented:

  • I downgraded to Python 2.7
  • I ensured that ‘C:Python27’ was towards the top of my Windows Environment variables
  • I installed Windows build tools with npm install –global –production windows-build-tools@4.0.0
  • I deleted my package-lock.json file and ran npm i once more

After these steps, my solution builds and runs.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement