Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
5
rated 0 times [  11] [ 6]  / answers: 1 / hits: 43984  / 9 Years ago, mon, july 6, 2015, 12:00:00

So I am trying to get the Node.js to work. Of course, it's not as easy as advertised :)



I happen to have two python versions on my computer, but Node.js seems to only work with the older one, 2.7. Upon error, it also encourages me to set the path into PYTHON environment variable with this error:



Error: Can't find Python executable python2.7, you can set the PYTHON env variable.


Ok then, I configured the variable as desired:



C:UsersJakub>set PYTHON=C:MYSELFProgramsPython2.7python.exe

C:UsersJakub>echo %PYTHON%
C:MYSELFProgramsPython2.7python.exe


You can see that I used echo to check whether the variable was really set. Unfortunatelly, that npm thing can't read it and the error appears again. Here's the full log right after I set the %PYTHON% variable:



C:UsersJakub>npm install minecraft-protocol



> [email protected] install C:UsersJakubnode_modulesminecraft-protocolnode_modulesursa
> node-gyp rebuild

|
C:UsersJakubnode_modulesminecraft-protocolnode_modulesursa>if not defined npm_config_node_gyp (node C:Program Files (x86)nodejsnode_modulesnpmbinnode-gyp-bin\....no
de_modulesnode-gypbinnode-gyp.js rebuild ) else (rebuild)
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable python2.7, you can set the PYTHON env variable.
gyp ERR! stack at failNoPython (C:Program Files (x86)nodejsnode_modulesnpmnode_modulesnode-gyplibconfigure.js:103:14)
gyp ERR! stack at C:Program Files (x86)nodejsnode_modulesnpmnode_modulesnode-gyplibconfigure.js:64:11
gyp ERR! stack at FSReqWrap.oncomplete (evalmachine.<anonymous>:95:15)

More From » python

 Answers
13

I figured out the most stable solution is to set python npm internal value to actual path:



npm config set python C:ProgramsPython2.7python2.7.exe


This skips all environment variable and %PATH% crap and just starts the python wherever it's installed.


[#65908] Friday, July 3, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
katieh

Total Points: 692
Total Questions: 104
Total Answers: 104

Location: Armenia
Member since Sat, Dec 31, 2022
1 Year ago
;