npm just won't install node sass - windows

I first encountered the issue when trying to use ionic and it needed the dependency for its templates. Then when I tried to install node-sass with npm myself the issue persisted. This is on Windows 10 Version 1703, both nodejs 6.11.3 and nodejs 8.4.0 tried out, ended up with same result. And VPN, http proxy were tried with no luck. Basically, it's saying :
Cannot download
"https://github.com/sass/node-sass/releases/download/v4.5.3/win32-x64-57_binding.node"
when nothing is fiddled with ,it says :
connect ECONNREFUSED 127.0.0.1:443
when using npm set config proxy,it says something like:
tunnel cannot be established
when using VPN,it waits forever at :
node scripts/install.js
or outputs the same as if nothing is fiddled with.
When reporting an bug, you must provide this information:
NPM version (npm -v): 5.3.0 with node latest(8.4.0), default version
with node 6.11.3
Node version (node -v):LTS(6.11.3) and LATEST(8.4.0)
Node Process (node -p process.versions):
{ http_parser: '2.7.0', node: '8.4.0', v8: '6.0.286.52', uv:
'1.13.1', zlib: '1.2.11', ares: '1.10.1-DEV', modules: '57', nghttp2:
'1.22.0', openssl: '1.0.2l', icu: '59.1', unicode: '9.0', cldr:
'31.0.1', tz: '2017b' }
Node Platform (node -p process.platform): win32
Node architecture (node -p process.arch): x64
node-sass version (node -p "require('node-sass').info"): Error:
Cannot find module 'node-sass'
npm node-sass versions (npm ls node-sass): `-- (empty)
and there is the output
---> npm install -g node-sass
C:\Users\rick\AppData\Roaming\npm\node-sass -> C:\Users\rick\AppData\Roaming\npm\node_modules\node-sass\bin\node-sass
> node-sass#4.5.3 install C:\Users\rick\AppData\Roaming\npm\node_modules\node-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.5.3/win32-x64-57_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.5.3/win32-x64-57_binding.node":
connect ECONNREFUSED 127.0.0.1:443
Hint: If github.com is not accessible in your location
try setting a proxy via HTTP_PROXY, e.g.
export HTTP_PROXY=http://example.com:1234
or configure npm proxy via
npm config set proxy http://example.com:8080
> node-sass#4.5.3 postinstall C:\Users\rick\AppData\Roaming\npm\node_modules\node-sass
> node scripts/build.js
Building: C:\Program Files\nodejs\node.exe C:\Users\rick\AppData\Roaming\npm\node_modules\node-sass\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli 'C:\\Users\\rick\\AppData\\Roaming\\npm\\node_modules\\node-sass\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli 'rebuild',
gyp verb cli '--verbose',
gyp verb cli '--libsass_ext=',
gyp verb cli '--libsass_cflags=',
gyp verb cli '--libsass_ldflags=',
gyp verb cli '--libsass_library=' ]
gyp info using node-gyp#3.6.2
gyp info using node#8.4.0 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed at getNotFoundError (C:\Users\rick\AppData\Roaming\npm\node_modules\node-sass\node_modules\which\which.js:13:12)
gyp verb `which` failed at F (C:\Users\rick\AppData\Roaming\npm\node_modules\node-sass\node_modules\which\which.js:68:19)
gyp verb `which` failed at E (C:\Users\rick\AppData\Roaming\npm\node_modules\node-sass\node_modules\which\which.js:80:29)
gyp verb `which` failed at C:\Users\rick\AppData\Roaming\npm\node_modules\node-sass\node_modules\which\which.js:89:16
gyp verb `which` failed at C:\Users\rick\AppData\Roaming\npm\node_modules\node-sass\node_modules\isexe\index.js:42:5
gyp verb `which` failed at C:\Users\rick\AppData\Roaming\npm\node_modules\node-sass\node_modules\isexe\windows.js:36:5
gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb `which` failed python2 { Error: not found: python2
gyp verb `which` failed at getNotFoundError (C:\Users\rick\AppData\Roaming\npm\node_modules\node-sass\node_modules\which\which.js:13:12)
gyp verb `which` failed at F (C:\Users\rick\AppData\Roaming\npm\node_modules\node-sass\node_modules\which\which.js:68:19)
gyp verb `which` failed at E (C:\Users\rick\AppData\Roaming\npm\node_modules\node-sass\node_modules\which\which.js:80:29)
gyp verb `which` failed at C:\Users\rick\AppData\Roaming\npm\node_modules\node-sass\node_modules\which\which.js:89:16
gyp verb `which` failed at C:\Users\rick\AppData\Roaming\npm\node_modules\node-sass\node_modules\isexe\index.js:42:5
gyp verb `which` failed at C:\Users\rick\AppData\Roaming\npm\node_modules\node-sass\node_modules\isexe\windows.js:36:5
gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb `which` failed stack: 'Error: not found: python2\n at getNotFoundError (C:\\Users\\rick\\AppData\\Roaming\\npm\\node_modules\\node-sass\\node_modules\\which\\which.js:13:12)\n at F (C:\\Users\\rick\\AppData\\Roaming\\npm\\node_modules\\node-sass\\node_modules\\which\\which.js:68:19)\n at E (C:\\Users\\rick\\AppData\\Roaming\\npm\\node_modules\\node-sass\\node_modules\\which\\which.js:80:29)\n at C:\\Users\\rick\\AppData\\Roaming\\npm\\node_modules\\node-sass\\node_modules\\which\\which.js:89:16\n at C:\\Users\\rick\\AppData\\Roaming\\npm\\node_modules\\node-sass\\node_modules\\isexe\\index.js:42:5\n at C:\\Users\\rick\\AppData\\Roaming\\npm\\node_modules\\node-sass\\node_modules\\isexe\\windows.js:36:5\n at FSReqWrap.oncomplete (fs.js:152:21)',
gyp verb `which` failed code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python C:\Program Files\Python36\python.EXE
gyp verb check python version `C:\Program Files\Python36\python.EXE -c "import platform; print(platform.python_version());"` returned: "3.6.2\r\n"
gyp verb could not find "C:\Program Files\Python36\python.EXE". checking python launcher
gyp verb could not find "C:\Program Files\Python36\python.EXE". guessing location
gyp verb ensuring that file exists: C:\Python27\python.exe
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:\Program Files\Python36\python.EXE", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Users\rick\AppData\Roaming\npm\node_modules\node-sass\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder.<anonymous> (C:\Users\rick\AppData\Roaming\npm\node_modules\node-sass\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack at C:\Users\rick\AppData\Roaming\npm\node_modules\node-sass\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\rick\\AppData\\Roaming\\npm\\node_modules\\node-sass\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\rick\AppData\Roaming\npm\node_modules\node-sass
gyp ERR! node -v v8.4.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Build failed with error code: 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass#4.5.3 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass#4.5.3 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\rick\AppData\Roaming\npm-cache\_logs\2017-09-10T18_52_13_062Z-debug.log
Then someone tells me:
Well ECONNREFUSED is easy - you have configured npm to talk to the
proxy at 127.0.0.1 (localhost) port 443 but the proxy does not seem to
be active for this port. Please check proxy/VPN software configuration
- port numbers must match.
But the thing is I don't have proxy configured. I tried npm config rm proxy,and npm config delete proxy, I even tried just go with it and set up a proxy then point npm to that proxy like I described above, nothing works.And here is the powershell enviroment config just in case:
⚡ rick#DESKTOP-1NVA03E  ~  $reg = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
⚡ rick#DESKTOP-1NVA03E  ~  $settings = Get-ItemProperty -Path $reg
⚡ rick#DESKTOP-1NVA03E  ~  $settings.ProxyServer
127.0.0.1:1080
⚡ rick#DESKTOP-1NVA03E  ~  $settings.ProxyEnable
0

I just came across the same problem. It was solved by installing Python v2.7 in C:\Python27\ . (I previously only had Python 3.6 installed in C:\Program Files\Python36\ )

it looks like compatibility issue of the node-sass module. You can solve this issue by following a few steps.
give the below command in your terminal
node list node-sass
It will list all your node-sass dependencies( including nested dependencies)
check all versions of node sass and also check supported node-sass for Node.js installed in your machine
You can either change the Node.js version in your machine or add the following code in package.json
"resolutions": {
"*/node-sass": "*"
},
Remove node_module folder and yarn.lock file (assuming that you use yarn) once you make the above change.
Install the node_modules using yarn install
If you prefer npm instead of yarn you might need to install an additional package called npm force resolutions

I had this issue for days looking for possible answers. I downgraded my node.js from 9.3.0 to v6.12.2 and run (all errors were gone):
npm update
Hopefully, this can help some of you who have encountered similar errors.

I have resolved this issue by changing compatible version of node.
It may be problem of compatibility of node version with node-sass version you are using.
Please check the below document to see the compatibility table and install appropriate node version.

Related

unable to perform npm installations in laravel vue project

I am performing npm install for my laravel vue project. But npm install is showing following errors:
gyp verb find Python Python is not set from command line or npm configuration
gyp verb find Python Python is not set from environment variable PYTHON
gyp verb find Python checking if "python3" can be used
gyp verb find Python - executing "python3" to get executable path
gyp verb find Python - "python3" is not in PATH or produced an error
gyp verb find Python checking if "python" can be used
gyp verb find Python - executing "python" to get executable path
gyp verb find Python - "python" is not in PATH or produced an error
gyp verb find Python checking if "python2" can be used
gyp verb find Python - executing "python2" to get executable path
gyp verb find Python - "python2" is not in PATH or produced an error
gyp verb find Python checking if Python is C:\Python37\python.exe
gyp verb find Python - executing "C:\Python37\python.exe" to get version
gyp verb find Python - "C:\Python37\python.exe" could not be run
gyp verb find Python checking if Python is C:\Python27\python.exe
gyp verb find Python - executing "C:\Python27\python.exe" to get version
gyp verb find Python - "C:\Python27\python.exe" could not be run
gyp verb find Python checking if the py launcher can be used to find Python
gyp verb find Python - executing "py.exe" to get Python executable path
gyp verb find Python - "py.exe" is not in PATH or produced an error
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python3" can be used
gyp ERR! find Python - "python3" is not in PATH or produced an error
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - "python" is not in PATH or produced an error
gyp ERR! find Python checking if "python2" can be used
gyp ERR! find Python - "python2" is not in PATH or produced an error
gyp ERR! find Python checking if Python is C:\Python37\python.exe
gyp ERR! find Python - "C:\Python37\python.exe" could not be run
gyp ERR! find Python checking if Python is C:\Python27\python.exe
gyp ERR! find Python - "C:\Python27\python.exe" could not be run
gyp ERR! find Python checking if the py launcher can be used to find Python
gyp ERR! find Python - "py.exe" is not in PATH or produced an error
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe"
gyp ERR! find Python (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python npm config set python "C:\Path\To\python.exe"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack at PythonFinder.fail (D:\Projects\Quadque-Tech-Server\node_modules\node-gyp\lib\find-python.js:302:47)
gyp ERR! stack at PythonFinder.runChecks (D:\Projects\Quadque-Tech-Server\node_modules\node-gyp\lib\find-python.js:136:21)
gyp ERR! stack at PythonFinder.<anonymous> (D:\Projects\Quadque-Tech-Server\node_modules\node-gyp\lib\find-python.js:200:18)
gyp ERR! stack at PythonFinder.execFileCallback (D:\Projects\Quadque-Tech-Server\node_modules\node-gyp\lib\find-python.js:266:16)
gyp ERR! stack at exithandler (node:child_process:420:5)
gyp ERR! stack at ChildProcess.errorhandler (node:child_process:432:5)
gyp ERR! stack at ChildProcess.emit (node:events:513:28)
gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:289:12)
gyp ERR! stack at onErrorNT (node:internal/child_process:476:16)
gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
gyp ERR! System Windows_NT 10.0.19044
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\Projects\\Quadque-Tech-Server\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd D:\Projects\Quadque-Tech-Server\node_modules\node-sass
gyp ERR! node -v v18.12.1
gyp ERR! node-gyp -v v7.1.2
gyp ERR! not ok
Build failed with error code: 1
npm WARN acorn-import-assertions#1.8.0 requires a peer of acorn#^8 but none is installed. You must install peer dependencies yourself.
npm WARN prosemirror-utils#0.9.6 requires a peer of prosemirror-tables#^0.9.1 but none is installed. You must install peer dependencies yourself.
npm WARN css-loader#1.0.1 requires a peer of webpack#^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN file-loader#2.0.0 requires a peer of webpack#^2.0.0 || ^3.0.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.3.2 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass#6.0.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass#6.0.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Tanjib\AppData\Roaming\npm-cache\_logs\2023-01-08T15_14_38_129Z-debug.log
Note: I installed something using yarn and after that this happened. I have not used yarn before. I think I messed up something.
Its always showing python errors. Why ?
I uninstalled and installed node.js freshly. But the error is not going . Help.
It means that either you haven't installed Python 3.x on your system, or that Python's installation binary folder isn't in your PATH. Python's installer should be able to add its installation's folder to your PATH environment variable.
If you do have Python installed, and still encounter this error, then do the following steps:
Right click on the start menu, go to System
Click advanced system settings
Click environment variables
Select PATH and click on Edit...
Click New and add Python's installation binary folder to the list.

I can not do yarn add because node-sass fails

I have a problem with yarn add && yard build.
Especially node-sass
Whenever I'm trying to run node-sass it is giving me this error
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/user/all001/app/themes/alliance/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Linux 4.15.0-54-generic
gyp ERR! command "/home/user/.nvm/versions/node/v14.4.0/bin/node" "/home/user/all001/app/themes/alliance/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/user/all001/app/themes/alliance/node_modules/node-sass
gyp ERR! node -v v14.4.0
gyp ERR! node-gyp -v v3.8.0
I really don't know how to fix this. Any suggestions, please?
I encountered the same error message when performing npm install node-sass. The only solution for me at the moment is to choose an older node version. Both v14 and v12 did not work, so I went back to v10. Luckily I had Node installed using nvm. You can run nvm install v10.22.1, for example. Use nvm ls-remote to see the available versions.
One difference, however, is that I tried to execute it on a Mac (System Darwin 19.6.0)

How to fix: gyp ERR! stack Error: Can't find Python executable "python"'

I've removed node modules and reinstall it but not solving the problem. If I run yarn add node-sass, the following error comes up in my terminal
gyp verb `which` failed at C:\Users\IT\Desktop\react-course-projects\indecision-app\node_modules\which\which.js:89:16
gyp verb `which` failed at C:\Users\IT\Desktop\react-course-projects\indecision-app\node_modules\isexe\index.js:42:5
gyp verb `which` failed at C:\Users\IT\Desktop\react-course-projects\indecision-app\node_modules\isexe\windows.js:36:5
gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:153:21)
gyp verb `which` failed stack:
gyp verb `which` failed 'Error: not found: python\n at getNotFoundError (C:\\Users\\IT\\Desktop\\react-course-projects\\indecision-app\\node_modules\\which\\which.js:13:12)\n at F (C:\\Users\\IT\\Desktop\\react-course-projects\\indecision-app\\node_modules\\which\\which.js:68:19)\n at E (C:\\Users\\IT\\Desktop\\react-course-projects\\indecision-app\\node_modules\\which\\which.js:80:29)\n at C:\\Users\\IT\\Desktop\\react-course-projects\\indecision-app\\node_modules\\which\\which.js:89:16\n at C:\\Users\\IT\\Desktop\\react-course-projects\\indecision-app\\node_modules\\isexe\\index.js:42:5\n at C:\\Users\\IT\\Desktop\\react-course-projects\\indecision-app\\node_modules\\isexe\\windows.js:36:5\n at FSReqWrap.oncomplete (fs.js:153:21)',
gyp verb `which` failed code: 'ENOENT' }
gyp verb could not find "python". checking python launcher
gyp verb could not find "python". guessing location
gyp verb ensuring that file exists: C:\Python27\python.exe
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Users\IT\Desktop\react-course-projects\indecision-app\node_modules\node-gyp\lib\configure.js:484:19)
gyp ERR! stack at PythonFinder.<anonymous> (C:\Users\IT\Desktop\react-course-projects\indecision-app\node_modules\node-gyp\lib\configure.js:509:16)
gyp ERR! stack at callback (C:\Users\IT\Desktop\react-course-projects\indecision-app\node_modules\graceful-fs\polyfills.js:295:20)
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:153:21)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\IT\\Desktop\\react-course-projects\\indecision-app\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\IT\Desktop\react-course-projects\indecision-app\node_modules\node-sass
gyp ERR! node -v v10.16.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
node and npm version are
node- v 10.16.0
npm -v 6.9.0
Follow the step:
npm install -g node-gyp
npm install --global --production windows-build-tools
this is the new error i got from running the last command you gave me
Error: spawnSync powershell.exe ENOENT
at Object.spawnSync (internal/child_process.js:1002:20)
at Object.spawnSync (child_process.js:614:24)
at spawnSync (C:\Users\AKA\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\in-gfw\lib\geo.js:67:36)
at Object.queryRegFromPowershell (C:\Users\AKA\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\in-gfw\lib\geo.js:73:3)
at loop (C:\Users\AKA\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\in-gfw\lib\geo.js:113:16)
at opts.shift (C:\Users\AKA\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\in-gfw\lib\geo.js:116:7)
at spawn (C:\Users\AKA\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\in-gfw\lib\geo.js:100:5)
at spawnSync (C:\Users\AKA\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\in-gfw\lib\geo.js:68:2)
at Object.queryRegFromRegExe (C:\Users\AKA\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\in-gfw\lib\geo.js:96:3)
at loop (C:\Users\AKA\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\in-gfw\lib\geo.js:113:16)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! windows-build-tools#4.0.0 postinstall: `node ./dist/index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the windows-build-tools#4.0.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Calling npm install as a 'bat' command in Jenkins Pipeline: Error should make the build step fail

I have a Jenkins Pipeline job (Windows) where I run the following 'bat' command inside a steps block:
bat '''cd .\\ProductName\\src\\ProductName.UI
echo Start: npm install
npm install -f'''
Currently, there is a situation where this command fails, but the build step does not fail. So, seemingly, an error code is not returned to Jenkins.
To be clear, I am not asking for help to fix this particular error. I am asking for help to make the error notify Jenkins that the build step has failed.
To give a bit of context, here is an excerpt of the 'npm install' error:
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed code: 'ENOENT' }
gyp verb could not find "python". checking python launcher
gyp verb could not find "python". guessing location
gyp verb ensuring that file exists: C:\Python27\python.exe
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! node -v v10.3.0
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok
Build failed with error code: 1
So does npm install return an error code which can in turn be returned from the batch job? Or is there something else that I am missing?

python error on npm package install Windows

On Windows, When I try to install wdio, I have a python error :
but python is installed and in the path.
the PYTHON variable is set to "C:\Program Files\Python36\python.exe", which is a correct path.
I don't know where the error is coming from, since it says it can find the executable, bit show the right path to the executable.
PS C:\Users\admin> npm install wdio
> fibers#1.0.15 install C:\Users\admin\node_modules\fibers
> node build.js || nodejs build.js
C:\Users\admin\node_modules\fibers>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild --release ) else (node "" rebuild --release )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:\Program Files\Python36\python.exe", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--release"
gyp ERR! cwd C:\Users\admin\node_modules\fibers
gyp ERR! node -v v8.0.0
gyp ERR! node-gyp -v v3.6.1
gyp ERR! not ok
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\admin\package.json'
You need to install Python 2.7 since node-gyp is not compatible with Python 3.x. See e.g. https://github.com/nodejs/node-gyp#on-windows
I had to reinstall node when I had similar issue ( this just updated to the current stable) Although before that I had updated every other thing while trying a solution including python for windows and node-gyp (npm install -g node-gyp). The node js update finally did it

Resources