installing parcel failed in windows10

Viewed 898

while trying to install parcel through npm in VScode, getting the below error.

npm ERR! code 1
npm ERR! path C:\Users\user-id\ws-js-001\node_modules\@parcel\watcher
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp-build
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.2.0 | win32 | x64
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 "python3.10"
npm ERR! gyp ERR! find Python - "python3.10" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking Python explicitly set from environment variable PYTHON
npm ERR! gyp ERR! find Python - process.env.PYTHON is "C:\Users\user-id\AppData\Local\Programs\Python\Python310\python.exe"
npm ERR! gyp ERR! find Python - "C:\Users\user-id\AppData\Local\Programs\Python\Python310\python.exe" is not in PATH 
or produced an error

The config value in config file is

C:\Users\user-id\ws-js-001> npm config get python
python3.10

Also the environment variable python is set to

C:\Windows\system32>set PYTHON
PYTHON=C:\Users\user-id\AppData\Local\Programs\Python\Python310\python.exe

Could you please help me with the changes that are required to fix this issue.

1 Answers

@parcel/watcher is a native C++ package that parcel uses to monitor your project for changes and re-build when it sees them. To create the bindings between native C++ and node under the hood, it uses node-gyp-build. According to node-gyp documentation:

node-gyp requires that you have installed a compatible version of Python, one of: v3.6, v3.7, v3.8, or v3.9.

So I'd recommend upgrading your version of python to one of the supported versions.

(Side note - it looks like @parcel/watcher includes a pre-built binaries for a number of platforms, including windows-x64, so that you don't need to build anything with node-gyp if you are consuming the package on those systems. My guess is that you're using 32-bit windows, because that doesn't seem to be included - is that right?)

Related