npm install xml2json fail to install - macos

I am trying to work on PUSh notifications for Android/ios using node.js.
I am getting the below error when I try to install xml2json.
Please help me to fix it
gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:43:28)
gyp ERR! stack at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:46:29)
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/which.js:57:16
gyp ERR! stack at Object.oncomplete (fs.js:107:15)
gyp ERR! System Darwin 12.5.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/bertils/node_modules/xml2json/node_modules/node-expat
gyp ERR! node -v v0.10.24
gyp ERR! node-gyp -v v0.12.1
gyp ERR! not ok
npm ERR! node-expat#2.0.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-expat#2.0.0 install script.
npm ERR! This is most likely a problem with the node-expat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls node-expat
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 12.5.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "xml2json"
npm ERR! cwd /Users/bertils
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.21
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/bertils/npm-debug.log
npm ERR! not ok code 0

Looks like the make tool is not available on your system.
To fix this, you have 2 options:
If you have Xcode already installed:
Go to Xcode > Preferences > Downloads and install the component named "Command Line Tools". All the relevant tools will be placed in /usr/bin.
Alternative:
Go to https://developer.apple.com/downloads, sign in with your developer Apple ID and search for "Command Line Tools", then download and install the appropriate file.

I was also facing the same issue on linux rhel 7, see if it works for you too, what I found out was that I needed to install gcc libraries on my instance, so I went ahead and removed my node_modules folder and then ran the sudo yum group install "Development Tools", in your case you might want to find the brew equivalent sudo yum group install "Development Tools" or xcode-select --install, and I then ran the npm install again and it worked!
Hope this helps, for issues related to installing gcc libraries and Development tools, one can refer to this url also: Install gcc and dev tools or Mac OS install dev tools

Related

appcelerator 5.1.0 ws/bufferutil build error

I tried to install appcelerator today on Win7. All I get is "Appcelerator CLI is installing or upgrading, please wait....".
installing by cli with
npm install appcelerator -g
fails with the following output. I tried installing 5.0.0 and got a different error message. Any ideas?
Finding version 5.1.0 ... OK
Validating security checksum OK
Installing ... OK
Compiling platform native modules ...
└ extract-opts/typechecker ... OK
└ bunyan/dtrace-provider ... OK
└ extract-opts/typechecker ... OK
└ socket.io-client/ws ... OK
└ appc-ldapjs/dtrace-provider ... OK
└ bunyan/dtrace-provider ... OK
└ appc-ldapjs/dtrace-provider ... OK
└ ws/bufferutil ... gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` fail
ed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\
npm\node_modules\node-gyp\lib\build.js:270:23)
gyp ERR! stack at emitTwo (events.js:100:13)
gyp ERR! stack at ChildProcess.emit (events.js:185:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_proces
s.js:200:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodej
s\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Drew\.appcelerator\install\5.1.0\package\node_modules\arro
w\node_modules\appc-pubsub\node_modules\socket.io-client\node_modules\engine.io-
client\node_modules\ws\node_modules\bufferutil
gyp ERR! node -v v5.5.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install" "bufferutil#1.2.1" "--production"
npm ERR! node v5.5.0
npm ERR! npm v3.3.12
npm ERR! code ELIFECYCLE
npm ERR! bufferutil#1.2.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bufferutil#1.2.1 install script 'node-gyp rebuild'.
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 bufferutil package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls bufferutil
npm ERR! There is likely additional logging output above.
Solved
I had to uninstall appcelerator and node.js. Then delete %APPDATA%npn and npn-cache. Then install appcelerator.
appcelerator also doesn't like it if you install jdk after installing jre.
Try to uninstall the node version. Open Appcelerator Studio, it will automatically install the node version. Next using command prompt run below commands:
npm install appcelerator -g
appc use latest
Hope this helps.
See https://www.robertkehoe.com/2015/03/fix-node-gyp-rebuild-error-on-windows/ which might help as well. Windows and node/node-gyp are a bit of a current challenge that the node community is dealing with right now.

Installing PhantomJS 2 using NPM fails on Windows

I'm trying to install PhantomJS 2 for a project that requires support for mutation observers. When I use the following command:
npm install phantomjs2 --save-dev
I get the following error:
Unexpected platform or architecture: win32 x64
npm ERR! phantomjs2#2.0.0 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phantomjs2#2.0.0 install script.
npm ERR! This is most likely a problem with the phantomjs2 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls phantomjs2
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodej
s\\node_modules\\npm\\bin\\npm-cli.js" "install" "phantomjs2" "--save-dev"
npm ERR! cwd g:\Web\GitHub\pet
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! g:\Web\GitHub\pet\npm-debug.log
npm ERR! not ok code 0
I am using 64 bit Windows 7. Is PhantomJS 2 just not supported on my platform?
Yes, that package currently doesn't support installing PhantomJS 2 on Windows. Just download it from the official page and put the exe in a directory that is in the PATH.

Unable to install Grunt through Terminal

Operating System: Mac
So I was trying to install Grunt by typing the following into my terminal (through /usr/local/bin):
npm install -g grunt-cli
But I get this as a result:
Error: EACCES, mkdir '/usr/local/lib/node_modules/grunt-cli'
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/grunt-cli']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/grunt-cli',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/grunt-cli',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR! '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53',
npm ERR! 'Object.oncomplete (fs.js:107:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 13.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "grunt-cli"
npm ERR! cwd /usr/local/bin
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! path /usr/local/lib/node_modules/grunt-cli
npm ERR! fstream_path /usr/local/lib/node_modules/grunt-cli
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/grunt-cli'
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /usr/local/bin/npm-debug.log
npm ERR! not ok code 0
...and that doesn't look too happy! Can anyone help me out here?
Note: I also initially tried doing it from just my usr, without the /local/bin but that came up with errors too.
I get the same result (OSX 10.9.5). It likely doesn't matter where you're running the command from - I'd expect you'd see the exact same paths erroring out.
The problem appears to be that npm wants to put globally installed packages under /usr/local/ (per https://www.npmjs.org/doc/files/npm-folders.html, executables in /usr/local/bin and modules in /usr/local/lib/node_modules on *NIX systems, which here includes OSX). This is not writable to your user on a Mac.
Your options are probably a few:
You could installing local to your project instead of globally (omit the -g). This would mean you need to reinstall the package in other project in which you want to use it. This also means you'll need to set up your PATH when you access the project to point to any binaries (e.g., grunt) under the project (export PATH=$PATH:./node_modules/bin), which you could do with a script, but may still be annoying.
You can also likely run the install again with sudo, but there are some risks there (pointed out in https://stackoverflow.com/a/25259232/1795230).
Finally, you can change the 'prefix' (via npm config set prefix ~/npm), as presented here: https://stackoverflow.com/a/21712034/1795230. This has the downside of not being "global" for real (just global to all the projects of your user) as pointed out in comment NPM won't install any package on Mac. New, clean build. `EACCES` & other errors, but that may work out fine, depending on your situation (works for me on my local dev machine).

npm install odbc fails on OSX and Ubuntu

I'm having an issue install the odbc package on both OSX and Ubuntu.
I have unixODBC installed on both machines.
Here is the output of issuing "npm install odbc":
npm http GET https://registry.npmjs.org/odbc
npm http 304 https://registry.npmjs.org/odbc
> odbc#0.6.3 preinstall /home/notes/as400/node_modules/odbc
> node-gyp configure build
Traceback (most recent call last):
File "/usr/share/node-v0.10.26-linux-x64/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 18, in <module>
sys.exit(gyp.script_main())
AttributeError: 'module' object has no attribute 'script_main'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/share/node-v0.10.26-linux-x64/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:337:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.11.0-12-generic
gyp ERR! command "node" "/usr/share/node-v0.10.26-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /home/notes/as400/node_modules/odbc
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm ERR! odbc#0.6.3 preinstall: `node-gyp configure build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the odbc#0.6.3 preinstall script.
npm ERR! This is most likely a problem with the odbc package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp configure build
npm ERR! You can get their info via:
npm ERR! npm owner ls odbc
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.11.0-12-generic
npm ERR! command "/usr/share/node/bin/node" "/usr/share/node/bin/npm" "install" "odbc"
npm ERR! cwd /home/notes/as400
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/notes/as400/npm-debug.log
npm ERR! not ok code 0
EDIT 03/05/2014
I installed unixODBC on my Mac using Macports without any issues. Now when I try "npm install odbc --save", I get the following error about sql.h missing:
npm http GET https://registry.npmjs.org/odbc
npm http 304 https://registry.npmjs.org/odbc
> odbc#0.6.3 preinstall /Users/patrick/IdeaProjects/XTL/vouchers-paid/node_modules/odbc
> node-gyp configure build
CXX(target) Release/obj.target/odbc_bindings/src/odbc.o
In file included from ../src/odbc.cpp:25:
../src/odbc.h:29:10: fatal error: 'sql.h' file not found
#include <sql.h>
^
1 error generated.
make: *** [Release/obj.target/odbc_bindings/src/odbc.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Darwin 13.0.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /Users/patrick/IdeaProjects/XTL/vouchers-paid/node_modules/odbc
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok
npm ERR! weird error 1
npm ERR! not ok code 0
Here is what worked for me (OSX 10.10.2)
Installing unixODBC via MacPorts did not work. The port itself
installs and automatically updates the include paths and the compiler
finds sql.h. But then the linker fails.
Installing unixodbc via Homebrew works. The include paths are not
updated, but this can be fixed, as indicated by the other answers.
For the installation of the odbc package you can use the following shell script:
#!/usr/bin/env bash
SRC_ODBC=/usr/local/Cellar/unixodbc/2.3.2_1/include
export C_INCLUDE_PATH=$C_INCLUDE_PATH:$SRC_ODBC
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:$SRC_ODBC
npm install odbc
As stated on npmjs.org there are additional binaries that need to be installed:
> on Ubuntu/Debian sudo apt-get install unixodbc unixodbc-dev
> on OSX using macports.org sudo port unixODBC
for more info: https://www.npmjs.org/package/odbc
sudo port unixODBC
is also wrong.
sudo port install unixodbc
is right.
Port install the lib and header files in other directories /opt/local/include and /opt/local/lib. To use them you have to told npm or the environment about.
But no idea how. May someone more experienced.
Or you use homebrew:
brew install unixodbc
That will work.
After installing using
sudo port install unixodbc
$ C_INCLUDE_PATH=/Where_You_Installed/ibm/dsdriver/include
$ CPLUS_INCLUDE_PATH=/Where_You_Installed/ibm/dsdriver/include
$ export C_INCLUDE_PATH
$ export CPLUS_INCLUDE_PATH
Then run
npm install ibm_db

Node.js install canvas failed on mac osx 10.8.4 : src/Canvas.h.....fatal error: v8.h file not found

I install nodejs following nodejs wiki, it's going well, and then install node canvas following this way https://github.com/LearnBoost/node-canvas/wiki/Installation---OSX, the steps before "$ npm install canvas" were going well, but the final step "$ npm install canvas" was failed again and again, I have tried install the Nodejs both building and installing, and i also try "sudo", and I have try "$ export PKG_CONFIG_PATH=.....", but still can't install canvas, I'm sure I have followed all the guide clarely.
Below is the log:
SLMacs-MacBook-Pro-2:~ percy$ npm install canvas
npm http GET https://registry.npmjs.org/canvas
npm http 304 https://registry.npmjs.org/canvas
> canvas#1.0.3 install /Users/macbookpro/node_modules/canvas
> node-gyp rebuild
CXX(target) Release/obj.target/canvas/src/Canvas.o
In file included from ../src/Canvas.cc:7:
../src/Canvas.h:11:10: fatal error: 'v8.h' file not found
#include <v8.h>
^
1 error generated.
make: *** [Release/obj.target/canvas/src/Canvas.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:96:17)
gyp ERR! stack at Process._handle.onexit (child_process.js:678:10)
gyp ERR! System Darwin 12.4.0
gyp ERR! command "node" "/usr/local/bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/macbookpro/node_modules/canvas
gyp ERR! node -v v0.8.12
gyp ERR! node-gyp -v v0.10.6
gyp ERR! not ok
npm ERR! canvas#1.0.3 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the canvas#1.0.3 install script.
npm ERR! This is most likely a problem with the canvas package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls canvas
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 12.4.0
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "canvas"
npm ERR! cwd /Users/macbookpro
npm ERR! node -v v0.8.12
npm ERR! npm -v 1.1.63
npm ERR! code ELIFECYCLE
npm ERR! Error: EACCES, open 'npm-debug.log'
npm ERR! { [Error: EACCES, open 'npm-debug.log'] errno: 3, code: 'EACCES', path: 'npm-debug.log' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 12.4.0
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "canvas"
npm ERR! cwd /Users/macbookpro
npm ERR! node -v v0.8.12
npm ERR! npm -v 1.1.63
npm ERR! path npm-debug.log
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open 'npm-debug.log'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/macbookpro/npm-debug.log
npm ERR! not ok code 0
I just ran into this problem myself. You may need to install some dependencies. Try running the following command in terminal.
brew install pkg-config cairo pango libpng jpeg giflib librsvg
Afterwards, rerun npm install. This worked for me.
To fix it:
Download the source code of node 0.10.13 from http://nodejs.org/dist/v0.10.13/node-v0.10.13.tar.gz
Extract this file via tar -xvz node-v0.10.13.tar.gz
Copy the 'deps', 'src' and 'tools' folders into '~/.node-gyp/0.10.13'
Then run 'npm install canvas' again.
I have no idea why the MacOS node package(just for v0.10.13) is missing these things.

Resources