title: Npm install error. 'npm ERR! gyp ERR! find Python, stack Error'
body: <p>Whenever I try to run <code>npm install</code> or <code>npm update</code> in my nuxt.js(vue.js) project, error below appears.</p>
  <pre><code>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 node-gyp@7.1.2
  npm ERR! gyp info using node@16.14.2 | 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 &quot;python3&quot; can be used
  npm ERR! gyp ERR! find Python - &quot;python3&quot; is not in PATH or produced an error
  npm ERR! gyp ERR! find Python checking if &quot;python&quot; can be used
  npm ERR! gyp ERR! find Python - &quot;python&quot; is not in PATH or produced an error
  npm ERR! gyp ERR! find Python checking if &quot;python2&quot; can be used
  npm ERR! gyp ERR! find Python - &quot;python2&quot; 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=&quot;/path/to/pythonexecutable&quot;
  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 &quot;/path/to/pythonexecutable&quot;
  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.&lt;anonymous&gt; (/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 &quot;/Users/kyeolhan/.nvm/versions/node/v16.14.2/bin/node&quot; &quot;/Users/kyeolhan/ForWork/BackOffceFront/node_modules/.bin/node-gyp&quot; &quot;rebuild&quot;
  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
  </code></pre>
  <p>python3 is installed in my mac (Apple M1 Pro, macOS Monterey 12.3).</p>
  <pre><code>$ python3 --version
  Python 3.9.12
  </code></pre>
  <p>I also tried with --python option with paths below.</p>
  <pre><code>$ which -a python3
  /opt/homebrew/bin/python3
  /usr/bin/python3
  /opt/homebrew/bin/python3
  </code></pre>
  <pre><code>npm i --python=&quot;/usr/bin/python3&quot;
  npm i --python=&quot;/opt/homebrew/bin/python3&quot;
  </code></pre>
  <p>But it doesn't work</p>
  <pre><code>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 node-gyp@9.0.0
  npm ERR! gyp info using node@16.14.2 | 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 - &quot;--python=&quot; or &quot;npm config get python&quot; is &quot;/usr/bin/python3&quot;
  npm ERR! gyp ERR! find Python - &quot;/usr/bin/python3&quot; 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 &quot;python3&quot; can be used
  npm ERR! gyp ERR! find Python - &quot;python3&quot; is not in PATH or produced an error
  npm ERR! gyp ERR! find Python checking if &quot;python&quot; can be used
  npm ERR! gyp ERR! find Python - &quot;python&quot; 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=&quot;/path/to/pythonexecutable&quot;
  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 &quot;/path/to/pythonexecutable&quot;
  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.&lt;anonymous&gt; (/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 &quot;/Users/kyeolhan/.nvm/versions/node/v16.14.2/bin/node&quot; &quot;/Users/kyeolhan/.nvm/versions/node/v16.14.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js&quot; &quot;rebuild&quot;
  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
  </code></pre>
  <p>I think the 'deasync' package is requiring python since only projects containing that package in package-lock.json make this error.</p>
  <p>How can I solve it?</p>