I can not do yarn add because node-sass fails - yarnpkg

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)

Related

How to solve gyp ERR! stack Error: `make` failed with exit code: 2?

I cloned a repo made by someone else to develop theia extension.
I ran the yarn command for the build, but the following error occurs.
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit ( [my directory]/node_modules/node-gyp/lib/build.js:203:23)
gyp ERR! stack at ChildProcess.emit (node:events:527:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Linux 3.10.0-1160.80.1.el7.x86_64
gyp ERR! command "/afs/[security]/app/vbuild/RHEL7-x86_64/nodejs/16.15.0/bin/node" "[my directory]/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd [my directory]/node_modules/#theia/node-pty
gyp ERR! node -v v16.15.0
As I searched on Google, I deleted node_modules, package-lock.json, yarn.lock, and downgraded node version to 14, but the same error occurs.
When I do npm install I get the following error:
npm ERR! code 1
npm ERR! path [my directory]/electron
npm ERR! command failed
npm ERR! command sh -c theia build --mode development
npm ERR! Updated dependencies, please run "install" again
Did anyone else encounter this issue, or knows how to fix it?
Here are the details of the environment I'm using:
OS : Red Hat Enterprise Linux Server release 7.9 (Maipo)
node version : v16.15.0
npm version : 8.5.5
yarn version : 1.7.0
theia version : 1.x
As the error shows npm and yarn arnet able to install the theia npm package.
Check that you are using the correct theia version and its supported by your node and operating system.
im not sure what you are running on windows or linux its worth checking this out https://github.com/eclipse-theia/theia/issues/188

Trying to install an app with node-sass on WSL. Getting "gyp ERR! stack Error: `make` failed with exit code: 2"

I was trying to install some magento storefront app that requires linux to run on WSL. I managed to get most things working, but in the end I'm stuck at trying to install the dependencies. When it tries to install node-sass, I get this error:
make: Leaving directory '/mnt/c/Github/psp-storefront-magento2/node_modules/node-sass/build'
make: *** [binding.target.mk:133: Release/obj.target/binding/src/binding.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/mnt/c/Github/psp-storefront-magento2/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (node:events:390:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Linux 4.4.0-19041-Microsoft
gyp ERR! command "/home/lursmani/.nvm/versions/node/v16.10.0/bin/node" "/mnt/c/Github/psp-storefront-magento2/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /mnt/c/Github/psp-storefront-magento2/node_modules/node-sass
gyp ERR! node -v v16.10.0
I read that deleting yarn.lock and installing again should fix this, but it hasn't helped in my case. Would greatly appreciate some help with this, if anyone knows what's funky here.
I found the solution. Apparently GYP has issues with the latest version of Node (16). I had to downgrade to Node 14 and then it worked correctly.

configure: error: C compiler cannot create executables mac

I am trying to install ccxt on my Macbook Air using sudo npm install --save ccxt and encountered the following error:
> scrypt#6.0.3 preinstall /Applications/Xcode.app/Contents/Developer/Toolchains/node_modules/scrypt
> node node-scrypt-preinstall.js
Error: Error: Command failed: ./configure
configure: error: in `/Applications/Xcode.app/Contents/Developer/Toolchains/node_modules/scrypt/scrypt/scrypt-1.2.0':
configure: error: C compiler cannot create executables
See `config.log' for more details
> scrypt#6.0.3 install /Applications/Xcode.app/Contents/Developer/Toolchains/node_modules/scrypt
> node-gyp rebuild
gyp ERR! configure error
gyp ERR! stack Error: Command failed: /Users/peterpham/anaconda3/bin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "<string>", line 1
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:275:12)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at maybeClose (internal/child_process.js:925:16)
gyp ERR! stack at Socket.stream.socket.on (internal/child_process.js:346:11)
gyp ERR! stack at emitOne (events.js:116:13)
gyp ERR! stack at Socket.emit (events.js:211:7)
gyp ERR! stack at Pipe._handle.close [as _onclose] (net.js:557:12)
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Applications/Xcode.app/Contents/Developer/Toolchains/node_modules/scrypt
gyp ERR! node -v v8.11.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open '/Applications/Xcode.app/Contents/Developer/Toolchains/package.json'
npm WARN Toolchains No description
npm WARN Toolchains No repository field.
npm WARN Toolchains No README data
npm WARN Toolchains No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! scrypt#6.0.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the scrypt#6.0.3 install 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! /Users/peterpham/.npm/_logs/2018-08-30T04_34_20_141Z-debug.log
I have Xcode 9.4.1 installed and checked that my command line tools were installed in the Preferences > Location section like in this other stackoverflow question. I also tried out all of the following answers in my terminal to change directories and ownerships to no avail. Also tried just sudo npm install --save scrypt with the same error. It has possibly something to do with the anaconda env pathing.
I'm pretty sure it has to do with some configuration but I'm not sure what it is. If you need anymore information please tell me and I'll post it. I don't know where the configure.log is so I can't post it, I've tried to find it using resources online as well and am lost.
The key to solving the error was this part of the error code:
gyp ERR! stack Error: Command failed: /Users/peterpham/anaconda3/bin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
So I tried installing python 2.7, which didn't work. So I tried uninstalling Anaconda from my computer using App Cleaner and that did the trick. Afterwards I could run the command npm install --save ccxt!

Yeoman Meanjs generator unable to get local issuer certificate

The company I work for uses a Zscaler proxy and I am trying to get the meanjs yeoman generator to work on my Windows 10 machine. So far I have managed to get npm to work by setting the proxy, https-proxy and the registry as follows:
npm config set proxy http://gateway.zscalerone.net/80
npm config set https-proxy http://gateway.zscalerone.net/80
npm config set registry http://registry.npmjs.org/
however when I run:
yo meanjs
I get the following:
Running npm install for you....
This may take a couple minutes.
Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "cd mean && npm install"
npm WARN deprecated minimatch#2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch#0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch#0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs#1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs#^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated graceful-fs#2.0.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs#^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated jade#0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated graceful-fs#3.0.8: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs#^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated lodash#1.0.2: lodash#<3.0.0 is no longer maintained. Upgrade to lodash#^4.0.0.
npm WARN deprecated minimatch#1.0.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN prefer global node-gyp#3.3.1 should be installed with -g
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: unable to get local issuer certificate
gyp ERR! stack at Error (native)
gyp ERR! stack at TLSSocket.<anonymous> (_tls_wrap.js:1017:38)
gyp ERR! stack at emitNone (events.js:67:13)
gyp ERR! stack at TLSSocket.emit (events.js:166:7)
gyp ERR! stack at TLSSocket._init.ssl.onclienthello.ssl.oncertcb.TLSSocket._finishInit (_tls_wrap.js:582:8)
gyp ERR! stack at TLSWrap.ssl.onclienthello.ssl.oncertcb.ssl.onnewsession.ssl.onhandshakedone (_tls_wrap.js:424:38)
gyp ERR! System Windows_NT 10.0.10240
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\ShaneH\\AppData\\Roaming\\nvm\\v4.4.5\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\ShaneH\Code\temp\mean\node_modules\bufferutil
gyp ERR! node -v v4.4.5
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm WARN install:bufferutil#1.2.1 bufferutil#1.2.1 install: `node-gyp rebuild`
npm WARN install:bufferutil#1.2.1 Exit status 1
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: unable to get local issuer certificate
gyp ERR! stack at Error (native)
gyp ERR! stack at TLSSocket.<anonymous> (_tls_wrap.js:1017:38)
gyp ERR! stack at emitNone (events.js:67:13)
gyp ERR! stack at TLSSocket.emit (events.js:166:7)
gyp ERR! stack at TLSSocket._init.ssl.onclienthello.ssl.oncertcb.TLSSocket._finishInit (_tls_wrap.js:582:8)
gyp ERR! stack at TLSWrap.ssl.onclienthello.ssl.oncertcb.ssl.onnewsession.ssl.onhandshakedone (_tls_wrap.js:424:38)
gyp ERR! System Windows_NT 10.0.10240
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\ShaneH\\AppData\\Roaming\\nvm\\v4.4.5\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\ShaneH\Code\temp\mean\node_modules\utf-8-validate
gyp ERR! node -v v4.4.5
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm WARN install:utf-8-validate#1.2.1 utf-8-validate#1.2.1 install: `node-gyp rebuild`
npm WARN install:utf-8-validate#1.2.1 Exit status 1
node-pre-gyp ERR! Tried to download: https://node-inspector.s3.amazonaws.com/debug/v0.7.7/node-v46-win32-ia32.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for v8-debug#0.7.7 and node#4.4.5 (node-v46 ABI) (falling back to source compile with node-gyp)
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: unable to get local issuer certificate
gyp ERR! stack at Error (native)
gyp ERR! stack at TLSSocket.<anonymous> (_tls_wrap.js:1017:38)
gyp ERR! stack at emitNone (events.js:67:13)
gyp ERR! stack at TLSSocket.emit (events.js:166:7)
gyp ERR! stack at TLSSocket._init.ssl.onclienthello.ssl.oncertcb.TLSSocket._finishInit (_tls_wrap.js:582:8)
gyp ERR! stack at TLSWrap.ssl.onclienthello.ssl.oncertcb.ssl.onnewsession.ssl.onhandshakedone (_tls_wrap.js:424:38)
gyp ERR! System Windows_NT 10.0.10240
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\ShaneH\\Code\\temp\\mean\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\Users\\ShaneH\\Code\\temp\\mean\\node_modules\\v8-debug\\build\\debug\\v0.7.7\\node-v46-win32-ia32\\debug.node" "--module_name=debug" "--module_path=C:\\Users\\ShaneH\\Code\\temp\\mean\\node_modules\\v8-debug\\build\\debug\\v0.7.7\\node-v46-win32-ia32" "--msvs_version=2015"
gyp ERR! cwd C:\Users\ShaneH\Code\temp\mean\node_modules\v8-debug
gyp ERR! node -v v4.4.5
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\ShaneH\Code\temp\mean\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\ShaneH\Code\temp\mean\node_modules\v8-debug\build\debug\v0.7.7\node-v46-win32-ia32\debug.node --module_name=debug --module_path=C:\Users\ShaneH\Code\temp\mean\node_modules\v8-debug\build\debug\v0.7.7\node-v46-win32-ia32 --msvs_version=2015' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (C:\Users\ShaneH\Code\temp\mean\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:87:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:172:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:827:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
node-pre-gyp ERR! System Windows_NT 10.0.10240
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\ShaneH\\Code\\temp\\mean\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Users\ShaneH\Code\temp\mean\node_modules\v8-debug
node-pre-gyp ERR! node -v v4.4.5
node-pre-gyp ERR! node-pre-gyp -v v0.6.28
node-pre-gyp ERR! not ok
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents#1.0.12
npm WARN eslint-config-airbnb#6.0.2 requires a peer of eslint-plugin-react#^4.0.0 but none was installed.
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.4.5
npm ERR! npm v3.9.6
npm ERR! code ELIFECYCLE
npm ERR! v8-debug#0.7.7 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the v8-debug#0.7.7 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the v8-debug package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs v8-debug
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls v8-debug
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\ShaneH\Code\temp\mean\npm-debug.log
at ChildProcess.exithandler (child_process.js:213:12)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:827:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
Which seems to indicate that it can't connect via https to
https://node-inspector.s3.amazonaws.com/debug/v0.7.7/node-v46-win32-ia32.tar.gz
I have tried setting up http_proxy and https_proxy environment variables, but this doesn't seem to have made a difference. I am also able to browse to that URL in a browser without an issue.
I assume the error has to do with the way Zscaler is handling https. Any help would be greatly appreciated.

installing d3 using npm causes contextify errors

Getting some mystifying contextify errors (but other installs seem to go fine.)
npm install d3
MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install
Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere.
[C:\Users\dinesh\m3\node_modules\d3\node_modules\jsdom\node_modules\contextify\build\binding.sln]
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:810:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\dinesh\m3\node_modules\d3\node_modules\jsdom\node_modules\contextify
gyp ERR! node -v v0.10.32
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
npm ERR! contextify#0.1.9 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
You've probably moved on at this point, but for future googlers:
Upgrade to D3.js v3.5.4+
jsdom is a dependency of d3, and jsdom requires contextify, which uses native modules (node-gyp). Native modules are hard to build on some platforms, so d3 made jsdom a development dependency (not installed by default) as of v3.5.4.
Related: D3.js commit and D3.js issue.

Resources