aletheia-foundation / aletheia-app

Alethia peer to peer publishing platform
http://aletheia-foundation.io/
GNU General Public License v3.0
48 stars 11 forks source link

Mac osx python path needed to be set #58

Closed songproducer closed 6 years ago

songproducer commented 6 years ago

When running: npm install

This was the error:

gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable "/usr/local/bin/python", you can set the PYTHON env variable. gyp ERR! stack at failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:449:14) gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:353:11 gyp ERR! stack at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:69:16) gyp ERR! stack at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:81:29) gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/which.js:90:16 gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:44:5 gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/access.js:8:5 gyp ERR! stack at FSReqWrap.oncomplete (fs.js:123:15) gyp ERR! System Darwin 16.7.0 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /Users/leotreasure/aletheia-app/node_modules/node-webcrypto-ossl gyp ERR! node -v v6.9.1 gyp ERR! node-gyp -v v3.4.0 gyp ERR! not ok

Solution is to set the correct python path for npm like this:

npm config set python /usr/bin/python

roo2 commented 6 years ago

Hey thanks for reporting! I'm wondering how we can get this to work on both systems with /usr/bin/python and /usr/local/bin/python though, I'm thinking something like

npm config set python $(which python)

but I wonder why that would be necessary, you'd think that node-webcrypto-ossl could use whichever system python is available. But thanks for the report I'll try and investigate this further

KadeMorton commented 6 years ago

@roo2 checking also, is this still an outstanding issue?

roo2 commented 6 years ago

Yea still outstanding, I haven't tested this one with OSX yet either

Yannael commented 6 years ago

It also seems that Python >2.5 and <3 must be used for compiling node-webcrypto-ossl

Python 3.6

npm config set python /path/to/python36/python
npm install

gives

> node-webcrypto-ossl@1.0.31 install 
/aletheia-app/node_modules/node-webcrypto-ossl
> node-gyp rebuild

gyp ERR! configure error
gyp ERR! stack Error: Python executable "/path/to/python36/python" is v3.6.1, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
gyp ERR! stack     at failPythonVersion (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:454:14)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:443:9
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:197:7)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at maybeClose (internal/child_process.js:877:16)
gyp ERR! stack     at Socket.<anonymous> (internal/child_process.js:334:11)
gyp ERR! stack     at emitOne (events.js:96:13)
gyp ERR! stack     at Socket.emit (events.js:188:7)
gyp ERR! stack     at Pipe._handle.close [as _onclose] (net.js:498:12)
gyp ERR! System Darwin 17.2.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd aletheia-app/node_modules/node-webcrypto-ossl
gyp ERR! node -v v6.9.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok

Python 2.7

npm config set python /path/to/python27/python
npm install

works fine. (tested with Anaconda distribution)

roo2 commented 6 years ago

@Yannael you legend!

DarinDev1000 commented 5 years ago

How do you set python2.7 as the global npm default?

KadeMorton commented 5 years ago

Hi @DarinDev1000 Unfortunately we don't have any developers working on the project at the moment, so I'm not able to answer your query. I am hoping to have some people working on this project in the new year though, so hopefully down the track we will get this sorted for you.

DarinDev1000 commented 5 years ago

No problem. I got it figured out.

latishk commented 5 years ago

@DarinDev1000 can u share the solution?

DarinDev1000 commented 5 years ago

@DarinDev1000 can u share the solution?

@latishk Here is how to change npm/node defaults. (FYI: After this, python3 is still my bash default. I did not change my PATH) (These instructions were created for a MAC)

This list all npm configurations currently set. npm config list You may see a userconfig file: /Users/<userName>/.npmrc and a globalconfig file: /Users/<userName>/.nvm/versions/node/v8.9.1/etc/npmrc

This list all configs including defaults: npm config ls -l

To set a global config, run: npm config set init-author-name "<Name>" -g This auto sets the npm author name every time you run "npm init". The "-g" tag sets a global config. Otherwise it is a user config. Another way to change this is to add init-author-name = "<Name>"

To set the python path, run: npm config set python </path/to/python2> -g For me, this was: npm config set python "/usr/bin/python2.7" -g or, edit the "globalconfig" file and add: python = "/usr/bin/python2.7"

After changing my npm python path, npm install ran correctly!

External reference: global npm setting defaults

I hope this helps. Let me know if you have questions.