node-gyp rebuild issue compiler - node.js

This issue doesn't seem to be the case with all of my projects, one in particular gives this issue when I run npm i (node v6.9.4 (npm v5.6.0) <- also not sure if this is right):
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__threading_support:25:11: fatal error:
'pthread.h' file not found
# include <pthread.h>
The error log:
12788 verbose stack Error: farmhash#1.2.1 install: `node-gyp rebuild`
12788 verbose stack Exit status 1
12788 verbose stack at EventEmitter.<anonymous> (/Users/tom.firth/.nvm/versions/node/v6.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
12788 verbose stack at emitTwo (events.js:106:13)
12788 verbose stack at EventEmitter.emit (events.js:191:7)
12788 verbose stack at ChildProcess.<anonymous> (/Users/tom.firth/.nvm/versions/node/v6.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
12788 verbose stack at emitTwo (events.js:106:13)
12788 verbose stack at ChildProcess.emit (events.js:191:7)
12788 verbose stack at maybeClose (internal/child_process.js:877:16)
12788 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
12789 verbose pkgid farmhash#1.2.1
12790 verbose cwd /Users/tom.firth/Sites/the-works
12791 verbose Darwin 16.7.0
12792 verbose argv "/Users/tom.firth/.nvm/versions/node/v6.9.4/bin/node" "/Users/tom.firth/.nvm/versions/node/v6.9.4/bin/npm" "i"
12793 verbose node v6.9.4
12794 verbose npm v5.6.0
12795 error code ELIFECYCLE
12796 error errno 1
12797 error farmhash#1.2.1 install: `node-gyp rebuild`
12797 error Exit status 1
12798 error Failed at the farmhash#1.2.1 install script.
12798 error This is probably not a problem with npm. There is likely additional logging output above.
12799 verbose exit [ 1, true ]
Both of these point to node-gyp rebuild - I haven't had this installed globally before, but i've tried it with and without and get the same error.
I have xcode 9.1 installed and ran:
$ xcode-select --install
which gives: xcode-select: error: command line tools are already installed, use "Software Update" to install updates
I followed the steps in: npmjs.com/fixing-npm-permissions
$ gcc --version
which gives:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.38)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ which gcc
which gives:
/usr/bin/gcc
The node-gyp issue makes me think it's related to the compiler but I have reinstalled xcode and node (via brew and nodejs.org)
Any help or suggestions would be really appreciated.
edit:
I have tried npm 3.10.10 because 5.6.0 obviously wasn't right. This was previously installed and didn't resolve the issue.
I installed xcode 8.2.1 to replace xcode 9.1, this didn't resolve the issue.

You basically need to install libtool to make it work. This was same issue I had when I was using bcrypt. If that doesn't seems to work you should have a look at this.
Also please check which version of python is installed supported version is 2.7 the latest 3.x is not supported yet as per node-gyp documentation. This node Js Workshop discuss more details about the gyp this should be of some help too.

I'm not entirely sure what the solution was.
I installed xcode 8.2.1 (down from 9.1). I had tried this before but
Initially this didn't work.
I then installed the commandlinetools manually (not via
xcode-select --install) (Library/Developer/CommandLineTools
didn't exist before or after this installation) - xcode-select -p
changed its path from pointing to xcode to commandlinetools even
though the dir didn't exist.
I then installed Xcode8.2.1 again, xcode-select's path automatically
changed without a reset (xcode-select --reset)
After this, my issue was resolved.

Related

Why doesn't npm start or npm install work?

I'm just getting started with react/firebase/expo so I'm really baffled on this one.
I'm not even sure how to explain what's happening, but basically if I try to run "npm install", I get the following output on the console:
E:\Visual Studio\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.WindowsSDK.targets(46,5): error MSB8036: The Windows SDK version 10.0.18362.0 was not found. Install the required version of Windows SDK or change the SDK version in the project p
roperty pages or by right-clicking the solution and selecting "Retarget solution". [C:\Users\User\source\repos\projeto\projeto\Moosic\node_modules\grpc\build\z.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `E:\Visual Studio\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Windows_NT 10.0.18363
Whole output is here: https://pastebin.com/85kSH3qt
If I run npm start, EXPO tells me
ERROR warn Package firebase has been ignored because it contains invalid configuration. Reason: Cannot find module 'firebase\package.json'
Require stack:
C:\Users\User\source\repos\projeto\projeto\Moosic\node_modules\react-native\node_modules#react-native-community\cli\build\tools\config\resolveNodeModuleDir.js
C:\Users\User\source\repos\projeto\projeto\Moosic\node_modules\react-native\node_modules#react-native-community\cli\build\tools\releaseChecker\index.js
C:\Users\User\source\repos\projeto\projeto\Moosic\node_modules\react-native\node_modules#react-native-community\cli\build\commands\start\runServer.js
C:\Users\User\source\repos\projeto\projeto\Moosic\node_modules\react-native\node_modules#react-native-community\cli\build\commands\start\start.js
C:\Users\User\source\repos\projeto\projeto\Moosic\node_modules\react-native\node_modules#react-native-community\cli\build\commands\index.js
C:\Users\User\source\repos\projeto\projeto\Moosic\node_modules\react-native\node_modules#react-native-community\cli\build\index.js
C:\Users\User\source\repos\projeto\projeto\Moosic\node_modules\react-native\local-cli\cli.js
I really have no clue what's happening. I'm trying to work on a shared repo and everyone else is managing to work just fine. I don't know if this is from a single cause, two different causes, or what is happening. Any help is appreciated, as I've been fighting this problem for the last day with no success.

Install node-sass on plesk

Ive been looking online for a solution to installing node-sass on my plesk server. I read that this is kind of a no no as this should not be done on a production server(dont care - not a live site).
I have uploaded the documents via bitbucket and click the NPM install button. The result is the failure below:
3822 verbose stack Error: node-sass#4.12.0 install: `node scripts/install.js`
3822 verbose stack spawn ENOENT
3822 verbose stack at ChildProcess.<anonymous> (/opt/plesk/node/9/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
3822 verbose stack at ChildProcess.emit (events.js:180:13)
3822 verbose stack at maybeClose (internal/child_process.js:936:16)
3822 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
3823 verbose pkgid node-sass#4.12.0
3824 verbose cwd /var/www/vhosts/mjmnagy.info/app
3825 verbose Linux 3.10.0-862.9.1.el7.x86_64
3826 verbose argv "/opt/plesk/node/9/bin/node" "/opt/plesk/node/9/bin/npm" "install"
3827 verbose node v9.10.1
3828 verbose npm v5.6.0
3829 error file sh
3830 error code ELIFECYCLE
3831 error errno ENOENT
3832 error syscall spawn
3833 error node-sass#4.12.0 install: `node scripts/install.js`
3833 error spawn ENOENT
3834 error Failed at the node-sass#4.12.0 install script.
3834 error This is probably not a problem with npm. There is likely additional logging output above.
3835 verbose exit [ 1, true ]
I attempted to login to the server using SSH but for the life of me couldn't figure out how to install it.
Using SSH, i navigated to where node is install (/opt/plesk/node/7/bin/) trying 6/7/8 and then running npm. i always got unrecognized command.
I then realized that the version i have of node-sass was higher than the node version install on the server(9.10.1)
What do i need to do to be able to install the module?
ignore plesks NPM install button and create a script in your package.json
"installme": "npm i --unsafe-perms"
Using plesk run the script
installme --scripts-node-prepend-path

Unable to install StackImpact on Azure Web App

I am unable to install the NodeJs perf monitor "StackImpact" on either of my Azure Web Apps (Windows based running Kudu). It all works fine locally on my Windows 10 laptop but NPM install fails on the servers (output below)
I've tried upgrading to Node 10.6 (latest version Azure supports), then downgrading back to Node 8.11.1. I double checked that the machines are running in 64bit.
...
89 verbose stack Error: stackimpact#1.3.10 install: `node node-gyp-fallback.js`
89 verbose stack Exit status 1
89 verbose stack at EventEmitter.<anonymous> (D:\Program Files (x86)\npm\6.1.0\node_modules\npm\node_modules\npm-lifecycle\index.js:304:16)
89 verbose stack at EventEmitter.emit (events.js:182:13)
89 verbose stack at ChildProcess.<anonymous> (D:\Program Files (x86)\npm\6.1.0\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
89 verbose stack at ChildProcess.emit (events.js:182:13)
89 verbose stack at maybeClose (internal/child_process.js:961:16)
89 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
90 verbose pkgid stackimpact#1.3.10
91 verbose cwd D:\home\site\wwwroot
92 verbose Windows_NT 10.0.14393
93 verbose argv "D:\\Program Files (x86)\\nodejs\\10.6.0\\node.exe" "D:\\Program Files (x86)\\npm\\6.1.0\\node_modules\\npm\\bin\\npm-cli.js" "install" "stackimpact"
94 verbose node v10.6.0
95 verbose npm v6.1.0
96 error code ELIFECYCLE
97 error errno 1
98 error stackimpact#1.3.10 install: `node node-gyp-fallback.js`
98 error Exit status 1
99 error Failed at the stackimpact#1.3.10 install script.
99 error This is probably not a problem with npm. There is likely additional logging output above.
100 verbose exit [ 1, true ]
Any help would be greatly appreciated!
soutarm. I reproduce your issue on my side.
According to my observation, it has nothing to do with node version or npm version. It said node-gyp not found.
So, I followed this case to run the command npm install -global node-gyp. You could check it under the D:\local\AppData\npm>.
As we know, node-gyp needs to rely on python2.7 and Microsoft's vc++ build tools for compilation, this is fine on Linux systems because Linux is installed by default, but the Windows operating system does not install python2.7 and vc++ Build tool by default.
I tried to install that npm install --global --production windows-build-tools but failed. It needs admin permission which is can't be touched by us in web app sandbox restrictions.
So,as workaround, maybe you have to install the packages locally then upload total node_modules folder to azure instead of installing packages in kudu.
Addition:
Azure support pointed out that the package only runs in 64 bit environments while their Web Apps run x86 Node by default, even if you've set the environment to x64.
You can override by manually copying x64 Node to the server, updating iisnode.yml to point to it then manually updating node_modules. All of which totally destroys any chance of a clean CI path.

Encountering problems while executing : npm install exec-sync

Version info :
node#4.6.0
node-gyp#3.4.0
npm#2.15.9
I try to install the following dependencies :
"canvas": "^1.1.6",
"exec-sync": "^0.1.6",
"fabric": "^1.6.0",
"request": "^2.67.0",
"word": "^0.2.4"
So i do an npm install the following dependencies are installed:
"canvas": "^1.1.6",
"fabric": "^1.6.0",
"request": "^2.67.0",
"word": "^0.2.4"
But the exec-sync delivers the following error:
1443 verbose stack Error: ffi#1.2.5 install: `node-gyp rebuild`
1443 verbose stack Exit status 1
1443 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:217:16)
1443 verbose stack at emitTwo (events.js:87:13)
1443 verbose stack at EventEmitter.emit (events.js:172:7)
1443 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:24:14)
1443 verbose stack at emitTwo (events.js:87:13)
1443 verbose stack at ChildProcess.emit (events.js:172:7)
1443 verbose stack at maybeClose (internal/child_process.js:829:16)
1443 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
Im a litte bit lost at this point, i tried the following things:
Deleted all the node_modules and tried an fresh install;
Tried installing the modules seperately;
Is it a version problem of node.js vs the exec-sync build?, im lost.
I fixed it!
CD to node_modules
git clone https://github.com/jeremyfa/node-exec-sync edit
open node-exec-sync/package.json to remove the ffi dependency line
npm install ./node-exec-sync
Here are the steps I followed as a workaround to npm install for testing:
removed exec-sync dependency from package.json
npm install ffi (installs latest version ok)
git clone https://github.com/jeremyfa/node-exec-sync
edit node-exec-sync/package.json to remove the ffi dependency line
npm install ./node-exec-sync then npm install finished ok
Don't use node-exec-sync, it's very difficult to install, on every OS that I've tried, for different reasons.
Instead, use https://www.npmjs.com/package/cross-spawn , which doesn't have any of these unbuildable native dependencies. It's basically an all-around better replacement for node-exec-sync or the built-in child_process APIs.

npm install, node-gyp rebuild error

I'm just starting out working with node.js and when I try npm install I get an error stating Failed at the bcrypt#0.8.5 install script 'node-gyp rebuild'. After extensive googling I still have not found the problem.
Here's the error log:
Error Log
313 verbose stack Error: bcrypt#0.8.5 install: `node-gyp rebuild`
313 verbose stack Exit status 1
313 verbose stack at EventEmitter.<anonymous> (C:\Users\Apparaat1\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:239:16)
313 verbose stack at emitTwo (events.js:100:13)
313 verbose stack at EventEmitter.emit (events.js:185:7)
313 verbose stack at ChildProcess.<anonymous> (C:\Users\Apparaat1\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:24:14)
313 verbose stack at emitTwo (events.js:100:13)
313 verbose stack at ChildProcess.emit (events.js:185:7)
313 verbose stack at maybeClose (internal/child_process.js:827:16)
313 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
314 verbose pkgid bcrypt#0.8.5
315 verbose cwd D:\Werk\W12C\we12c\W12C
316 error Windows_NT 6.1.7601
317 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Apparaat1\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
318 error node v5.7.0
319 error npm v3.7.3
320 error code ELIFECYCLE
321 error bcrypt#0.8.5 install: `node-gyp rebuild`
321 error Exit status 1
322 error Failed at the bcrypt#0.8.5 install script 'node-gyp rebuild'.
322 error Make sure you have the latest version of node.js and npm installed.
322 error If you do, this is most likely a problem with the bcrypt package,
322 error not with npm itself.
322 error Tell the author that this fails on your system:
322 error node-gyp rebuild
322 error You can get information on how to open an issue for this project with:
322 error npm bugs bcrypt
322 error Or if that isn't available, you can get their info via:
322 error npm owner ls bcrypt
322 error There is likely additional logging output above.
323 verbose exit [ 1, true ]
Versions:
node -v
v5.7.0
npm -v
3.7.3
May be it's a little bit late but the solution in node-gyp
https://github.com/nodejs/node-gyp#installation
There are 2
different options.
Option 1: Install all the required tools and configurations using Microsoft's windows-build-tools using npm install --global --production windows-build-tools from an elevated PowerShell or CMD.exe (run as Administrator).
Option 2: Install tools and configuration manually:
Visual C++ Build Environment:
Option 1: Install Visual C++ Build Tools using the Default Install option.
Option 2: Install Visual Studio 2015 (or modify an existing installation) and select Common Tools for Visual C++ during setup. This also works with the free Community and Express for Desktop editions.
Install Python 2.7 (v3.x.x is not supported), and run npm config set python python2.7 (or see below for further instructions on specifying the proper Python version and path.)
Launch cmd, npm config set msvs_version 2015
If the above steps didn't work for you, please visit Microsoft's Node.js Guidelines for Windows for additional tips.
[Windows Vista / 7 only] requires .NET Framework 4.5.1

Resources