alex toader
alex toader

Reputation: 2418

How to put python in path - Ubuntu 20 npm install fails

I am doing a fresh install of Ubuntu 20 I installed npm with nvm Now when I run npm install, I get this error about python

> onfigure [] gyp verb check python checking for Python executable
> ":/usr/bin/python" in the PATH gyp verb `which` failed Error: not
> found: :/usr/bin/python gyp verb `which` failed     at
> getNotFoundError (/var/www/forum/node_modules/which/which.js:13:12)
> gyp verb `which` failed     at F
> (/var/www/forum/node_modules/which/which.js:68:19) gyp verb `which`
> failed     at E (/var/www/forum/node_modules/which/which.js:80:29) gyp
> verb `which` failed     at
> /var/www/forum/node_modules/which/which.js:89:16 gyp verb `which`
> failed     at /var/www/forum/node_modules/isexe/index.js:42:5 gyp verb
> `which` failed     at /var/www/forum/node_modules/isexe/mode.js:8:5
> gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:168:21)
> gyp verb `which` failed  :/usr/bin/python Error: not found:
> :/usr/bin/python gyp verb `which` failed     at getNotFoundError
> (/var/www/forum/node_modules/which/which.js:13:12) gyp verb `which`
> failed     at F (/var/www/forum/node_modules/which/which.js:68:19) gyp
> verb `which` failed     at E
> (/var/www/forum/node_modules/which/which.js:80:29) gyp verb `which`
> failed     at /var/www/forum/node_modules/which/which.js:89:16 gyp
> verb `which` failed     at
> /var/www/forum/node_modules/isexe/index.js:42:5 gyp verb `which`
> failed     at /var/www/forum/node_modules/isexe/mode.js:8:5 gyp verb
> `which` failed     at FSReqCallback.oncomplete (fs.js:168:21) { gyp
> verb `which` failed   code: 'ENOENT' gyp verb `which` failed } gyp
> ERR! configure error  gyp ERR! stack Error: Can't find Python
> executable ":/usr/bin/python", you can set the PYTHON env variable.
> gyp ERR! stack     at PythonFinder.failNoPython
> (/var/www/forum/node_modules/node-gyp/lib/configure.js:484:19) gyp
> ERR! stack     at PythonFinder.<anonymous>
> (/var/www/forum/node_modules/node-gyp/lib/configure.js:406:16) gyp
> ERR! stack     at F (/var/www/forum/node_modules/which/which.js:68:16)
> gyp ERR! stack     at E
> (/var/www/forum/node_modules/which/which.js:80:29) gyp ERR! stack    
> at /var/www/forum/node_modules/which/which.js:89:16 gyp ERR! stack    
> at /var/www/forum/node_modules/isexe/index.js:42:5 gyp ERR! stack    
> at /var/www/forum/node_modules/isexe/mode.js:8:5 gyp ERR! stack     at
> FSReqCallback.oncomplete (fs.js:168:21) gyp ERR! System Linux
> 5.4.0-42-generic gyp ERR! command "/home/alex/.nvm/versions/node/v12.18.3/bin/node"
> "/var/www/forum/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
> "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags="
> "--libsass_library=" gyp ERR! cwd
> /var/www/forum/node_modules/node-sass gyp ERR! node -v v12.18.3 gyp
> ERR! node-gyp -v v3.8.0 gyp ERR! not ok  Build failed with error code:
> 1 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2
> (node_modules/chokidar/node_modules/fsevents): npm WARN notsup
> SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]:
> wanted {"os":"darwin","arch":"any"} (current:
> {"os":"linux","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL
> DEPENDENCY: fsevents@^1.0.0
> (node_modules/laravel-mix/node_modules/chokidar/node_modules/fsevents):
> npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for
> [email protected]: wanted {"os":"darwin","arch":"any"} (current:
> {"os":"linux","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL
> DEPENDENCY: fsevents@^1.2.7
> (node_modules/watchpack-chokidar2/node_modules/chokidar/node_modules/fsevents):
> npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for
> [email protected]: wanted {"os":"darwin","arch":"any"} (current:
> {"os":"linux","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL
> DEPENDENCY: fsevents@^1.2.7
> (node_modules/webpack-dev-server/node_modules/chokidar/node_modules/fsevents):
> npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for
> [email protected]: wanted {"os":"darwin","arch":"any"} (current:
> {"os":"linux","arch":"x64"}) npm WARN [email protected] requires a
> peer of ajv@^6.9.1 but none is installed. You must install peer
> dependencies yourself. npm WARN [email protected] requires a
> peer of eslint@>=4.1.1 but none is installed. You must install peer
> dependencies yourself.
> 
> npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected]
> postinstall: `node scripts/build.js` npm ERR! Exit status 1 npm ERR! 
> npm ERR! Failed at the [email protected] postinstall script. npm ERR!
> This is probably not a problem with npm. There is likely additional
> logging output above.

On commant

which python

, I get nothing but when I run

whereis python

I get

python: /usr/bin/python3.8 /usr/bin/python /usr/lib/python2.7 /usr/lib/python3.8 /etc/python3.8 /usr/local/lib/python3.8 /usr/include/python3.8

when I run python it runs ok

python
Python 3.8.2 (default, Jul 16 2020, 14:00:26) 
[GCC 9.3.0] on linux

Upvotes: 1

Views: 10647

Answers (1)

Saurabh Badenkal
Saurabh Badenkal

Reputation: 97

seems to be some dependancies issues check this out, https://github.com/wodby/docker4drupal/issues/321
also it might need python2 instead of 3
try aliasing python to python 2.7 instead of 3, https://askubuntu.com/questions/320996/how-to-make-python-program-command-execute-python-3

Upvotes: 4

Related Questions