Reputation: 591
Whenever I try to run npm install
or npm update
in my nuxt.js(vue.js) project, error below appears.
npm ERR! code 1
npm ERR! path /Users/kyeolhan/ForWork/BackOffceFront/node_modules/deasync
npm ERR! command failed
npm ERR! command sh -c node ./build.js
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
npm ERR! gyp ERR! find Python checking if "python3" can be used
npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if "python" can be used
npm ERR! gyp ERR! find Python - "python" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if "python2" can be used
npm ERR! gyp ERR! find Python - "python2" is not in PATH or produced an error
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python You need to install the latest version of Python.
npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
npm ERR! gyp ERR! find Python you can try one of the following options:
npm ERR! gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
npm ERR! gyp ERR! find Python (accepted by both node-gyp and npm)
npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
npm ERR! gyp ERR! find Python npm config set python "/path/to/pythonexecutable"
npm ERR! gyp ERR! find Python For more information consult the documentation at:
npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
npm ERR! gyp ERR! stack at PythonFinder.fail (/Users/kyeolhan/ForWork/BackOffceFront/node_modules/node-gyp/lib/find-python.js:302:47)
npm ERR! gyp ERR! stack at PythonFinder.runChecks (/Users/kyeolhan/ForWork/BackOffceFront/node_modules/node-gyp/lib/find-python.js:136:21)
npm ERR! gyp ERR! stack at PythonFinder.<anonymous> (/Users/kyeolhan/ForWork/BackOffceFront/node_modules/node-gyp/lib/find-python.js:179:16)
npm ERR! gyp ERR! stack at PythonFinder.execFileCallback (/Users/kyeolhan/ForWork/BackOffceFront/node_modules/node-gyp/lib/find-python.js:266:16)
npm ERR! gyp ERR! stack at exithandler (node:child_process:406:5)
npm ERR! gyp ERR! stack at ChildProcess.errorhandler (node:child_process:418:5)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:526:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
npm ERR! gyp ERR! stack at onErrorNT (node:internal/child_process:478:16)
npm ERR! gyp ERR! stack at processTicksAndRejections (node:internal/process/task_queues:83:21)
npm ERR! gyp ERR! System Darwin 21.4.0
npm ERR! gyp ERR! command "/Users/kyeolhan/.nvm/versions/node/v16.14.2/bin/node" "/Users/kyeolhan/ForWork/BackOffceFront/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /Users/kyeolhan/ForWork/BackOffceFront/node_modules/deasync
npm ERR! gyp ERR! node -v v16.14.2
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
npm ERR! Build failed
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/kyeolhan/.npm/_logs/2022-03-28T12_56_28_864Z-debug-0.log
python3 is installed in my mac (Apple M1 Pro, macOS Monterey 12.3).
$ python3 --version
Python 3.9.12
I also tried with --python option with paths below.
$ which -a python3
/opt/homebrew/bin/python3
/usr/bin/python3
/opt/homebrew/bin/python3
npm i --python="/usr/bin/python3"
npm i --python="/opt/homebrew/bin/python3"
But it doesn't work
npm ERR! code 1
npm ERR! path /Users/kyeolhan/ForWork/BackOffceFront/node_modules/deasync
npm ERR! command failed
npm ERR! command sh -c node ./build.js
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python checking Python explicitly set from command line or npm configuration
npm ERR! gyp ERR! find Python - "--python=" or "npm config get python" is "/usr/bin/python3"
npm ERR! gyp ERR! find Python - "/usr/bin/python3" is not in PATH or produced an error
npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
npm ERR! gyp ERR! find Python checking if "python3" can be used
npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if "python" can be used
npm ERR! gyp ERR! find Python - "python" is not in PATH or produced an error
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python You need to install the latest version of Python.
npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
npm ERR! gyp ERR! find Python you can try one of the following options:
npm ERR! gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
npm ERR! gyp ERR! find Python (accepted by both node-gyp and npm)
npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
npm ERR! gyp ERR! find Python npm config set python "/path/to/pythonexecutable"
npm ERR! gyp ERR! find Python For more information consult the documentation at:
npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
npm ERR! gyp ERR! stack at PythonFinder.fail (/Users/kyeolhan/.nvm/versions/node/v16.14.2/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:330:47)
npm ERR! gyp ERR! stack at PythonFinder.runChecks (/Users/kyeolhan/.nvm/versions/node/v16.14.2/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:159:21)
npm ERR! gyp ERR! stack at PythonFinder.<anonymous> (/Users/kyeolhan/.nvm/versions/node/v16.14.2/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:202:16)
npm ERR! gyp ERR! stack at PythonFinder.execFileCallback (/Users/kyeolhan/.nvm/versions/node/v16.14.2/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:294:16)
npm ERR! gyp ERR! stack at exithandler (node:child_process:406:5)
npm ERR! gyp ERR! stack at ChildProcess.errorhandler (node:child_process:418:5)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:526:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
npm ERR! gyp ERR! stack at onErrorNT (node:internal/child_process:478:16)
npm ERR! gyp ERR! stack at processTicksAndRejections (node:internal/process/task_queues:83:21)
npm ERR! gyp ERR! System Darwin 21.4.0
npm ERR! gyp ERR! command "/Users/kyeolhan/.nvm/versions/node/v16.14.2/bin/node" "/Users/kyeolhan/.nvm/versions/node/v16.14.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /Users/kyeolhan/ForWork/BackOffceFront/node_modules/deasync
npm ERR! gyp ERR! node -v v16.14.2
npm ERR! gyp ERR! node-gyp -v v9.0.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/kyeolhan/.npm/_logs/2022-03-28T13_05_45_769Z-debug-0.log
I think the 'deasync' package is requiring python since only projects containing that package in package-lock.json make this error.
How can I solve it?
Upvotes: 7
Views: 48881
Reputation: 3055
I resolved by:
apt install build-essential -y
apt install python3 -y
Upvotes: -3
Reputation: 21
Yes downgrading to nodejs V 14.19.a worked for me as well. You are probably try to run react app to test services like aws.
if you dont downgrade it remove the node saas dependency as it is not compatible with new version of node js but then if your code again give error if they require the package.
Upvotes: 2
Reputation: 591
I resolved this issue by downgrading node version (to v14.19.1).
#reference!
How to solve npm install error “npm ERR! code 1”
Upvotes: 10