can't npm install bcrypt in my docker image - node.js

I'm trying to get my Sails.js app up and running using the standard node Docker image but the build is failing when it tries to npm install bcrypt.
> bcrypt#0.8.0 install /myapp/node_modules/bcrypt
> node-gyp rebuild
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: node-v0.10.33.tar.gz local checksum 822ba41f2d77b704ab63e244dfef7431b31893c19bfe3bf228c06b6aff063ed5 not match remote 75dc26c33144e6d0dc91cb0d68aaf0570ed0a7e4b0c35f3a7a726b500edd081e
gyp ERR! stack at deref (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:299:20)
gyp ERR! stack at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:340:13)
gyp ERR! stack at IncomingMessage.emit (events.js:117:20)
gyp ERR! stack at _stream_readable.js:943:16
gyp ERR! stack at process._tickCallback (node.js:419:13)
gyp ERR! System Linux 3.16.1-tinycore64
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /pos/node_modules/bcrypt
gyp ERR! node -v v0.10.33
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok
Alternatively sometimes it simply fails as follows:
> bcrypt#0.8.0 install /myapp/node_modules/bcrypt
> node-gyp rebuild
Killed
And sometimes it just hangs indefinitely at
> bcrypt#0.8.0 install /pos/node_modules/bcrypt
> node-gyp rebuild
My Dockerfile looks like:
FROM node:0.10.33
# copy the source files into the image
ADD . /myapp
# Define working directory.
WORKDIR /myapp
# Install node-gyp as global and ensure it's all clean and tide
RUN npm install -g node-gyp && \
node-gyp clean && \
npm cache clean
# Install project dependencies
RUN npm install
# Expose sails port (still in development mind you)
EXPOSE 1337
# Define default command.
CMD ["node app"]
Things I've tried
this post in another Stackoverflow thread suggested I should also RUN apt-get -y install g++ but adding that to my Dockerfile made no difference and it just reports that g++ is already the newest version.
this post suggested I ensure openssl is installed so I added RUN apt-get install -y openssl that that also reported openssl is already the newest version.
I've also tried RUN apt-get install -y build-essential but that too reports that it's already the latest version.
I've seen suggestions that Node needs to be installed as a legacy version, which is something the standard Node image ought to be responsible for, if necessary I believe, so I've also reported this as an issue with the docker-library/node project.
In the meantime, what else ought I try?

Thanks to everyone whose advice in the comments and answers steered me to my conclusion.
The issue was either some sort of corruption within my docker install, or some sort of incompatibility between dvm and fig, but I solved this problem as follows
dvm down
brew remove fig
brew remove dvm
brew remove docker
brew cleanup --force -s
rm -rf ~/VirtualBox VMs/boot2docker-vm
brew install docker
brew install boot2docker
boot2docker init
boot2docker up
echo export DOCKER_TLS_VERIFY=1 > ~/.bash_profile
echo export DOCKER_CERT_PATH=~/.boot2docker/certs/boot2docker-vm > ~/.bash_profile
echo export DOCKER_HOST=tcp://$(boot2docker ip 2>/dev/null):2375 > ~/.bash_profile
export DOCKER_HOST=tcp://$(boot2docker ip 2>/dev/null):2375
brew install fig
fig build web
and voila - it worked.
The trick really seemed to be that I had a couple of conflicting bits of crud in my original boot2docker-vm from having it installed originally via the installer and then later by homebrew and boot2docker colliding somehow with dvm. By wiping it all back to bare metal and rebuilding from scratch it all worked nicely.

Related

npm install error with docker - kurento application

I am trying to install a kurento webserver in docker container.
And trying to execute the kurento one to one call tutorial.
I am getting a error during the step npm install.
Step:
RUN cd kurento-tutorial-node/kurento-one2one-call && npm install
Error is as follows:
> node-gyp rebuild
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 failNoPython (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:401:14)
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:330:11
gyp ERR! stack at F (/usr/lib/node_modules/npm/node_modules/which/which.js:63:16)
gyp ERR! stack at E (/usr/lib/node_modules/npm/node_modules/which/which.js:72:29)
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/which.js:81:16
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:44:5
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/node_modules/isexe/mode.js:8:5
gyp ERR! stack at Object.oncomplete (fs.js:108:15)
gyp ERR! System Linux 3.13.0-32-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /kurento-tutorial-node/kurento-one2one-call/node_modules/ws/node_modules/utf-8-validate
gyp ERR! node -v v0.10.46
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
Some one help me with the same.
Docker file is as follows:
FROM ubuntu:14.04
MAINTAINER USER1 "muraliselva.10#gmail.com"
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
RUN apt-get update
RUN apt-get install wget -y
RUN apt-get install git -y
RUN apt-get install curl -y
RUN echo "deb http://ubuntu.kurento.org trusty kms6" | sudo tee /etc/apt/sources.list.d/kurento.list
RUN wget -O - http://ubuntu.kurento.org/kurento.gpg.key | sudo apt-key add -
RUN apt-get update -y
RUN apt-get install kurento-media-server-6.0 -y
RUN sudo service kurento-media-server-6.0 start
RUN sudo service kurento-media-server-6.0 stop
RUN curl -sL https://deb.nodesource.com/setup | sudo bash -
RUN sudo apt-get install -y nodejs -y
RUN sudo npm install -g bower -y
RUN git clone https://github.com/Kurento/kurento-tutorial-node.git
RUN cd kurento-tutorial-node/kurento-one2one-call && pwd
RUN cd kurento-tutorial-node/kurento-one2one-call && git checkout 6.5.0
RUN sudo service kurento-media-server-6.0 start
RUN cd kurento-tutorial-node/kurento-one2one-call && npm install
EXPOSE 8443
Some one help me with fixing the error.
Node version in standard Ubuntu 14.04 packages is pretty old (0.10). Use the installation instructions from the nodejs web page instead.
You can also choose to build your container FROM a node image, and then install Kurento and the kurento one-to-one tutorial on top of that. However, take into account that running several processes within a container can be cumbersome and error prone. Specially when some of the processes are run as services. There are instructions on the official Docker documentation on how to achieve that using Supervisor.

trying to install bcrypt into node project + node set up issues

I have seen some very similar questions but none that I have found seem to work. I am trying to npm install bcrypt but i keep getting the error below.
bycrypt is the command that I use to install bcrypt modules. I do have Xcode and installing node-gyp does not seem to make a difference
regan#the-Voyagur buddha-bar (feature/styles) $ npm install --save bcrypt
npm WARN package.json mongo#0.1.0 No repository field.
npm WARN package.json mongo#0.1.0 No README data
-
> bcrypt#0.8.0 install /Users/regan/lighthouse/buddha-bar/node_modules/bcrypt
> node-gyp rebuild
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:343:16)
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 Darwin 14.0.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/regan/lighthouse/buddha-bar/node_modules/bcrypt
gyp ERR! node -v v0.10.33
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
npm ERR! bcrypt#0.8.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt#0.8.0 install script.
npm ERR! This is most likely a problem with the bcrypt 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 bcrypt
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 14.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "--save" "bcrypt"
npm ERR! cwd /Users/regan/lighthouse/buddha-bar
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0
regan#the-Voyagur buddha-bar (feature/styles) $ xcode-select --print-path
/Library/Developer/CommandLineTools
OP managed to fix this for themselves with:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/
but graciously accepted my answer anyway.
Original answer below:
There are two distinct problems here. One is that your node is slightly out of date and your npm is substantially out of date.
You're using OSX, so there are a number of popular ways to manage different node versions. Here's a guide on updating node https://github.com/npm/npm/wiki/Troubleshooting#updating-node-on-osx
Then you'll want to update to the latest npm:
npm install -g npm#latest
Finally, it looks like although you have XCode installed, something is still awry. You report that this command yields
$ xcode-select --print-path
/Library/Developer/CommandLineTools
On my system, which is OSX/Yosemite and can build native addon modules, I see
$ xcode-select --print-path
/Applications/Xcode.app/Contents/Developer
You may need to switch your xcode path to a different directory. For starters, though, please update to the current node and npm tools and try the installation again; if it still fails, the least dangerous next thing to try is
xcode-select --install
If none of that fixes things, let me know and I'll try to help further.
I was having a similar issue but with a different package.
node-gyp rebuild
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
gyp: No Xcode or CLT version detected!
gyp ERR! configure error
Running macOS Catalina 10.15.2, I tried the following:
$ xcode-select --install
xcode-select: error: command line tools are already installed,
use "Software Update" to install updates
Fixed it by doing the following:
$ [sudo] xcode-select --reset
Hope this helps someone in the future.
EDIT
If someone is still running into issues, there's a thread on GitHub that has other solutions worth trying:
github.com/schnerd/d3-scale-cluster/issues
I had a simliar problem. Solving it was simple in the end.
Just had to run
xcode-select --install
to install the newest tools and then
sudo xcodebuild -license
to agree to the new License terms. Afterwards bcrypt got installed without any problems.
If sudo xcode-select --switch $(xcode-select -print-path) does not work for you, try re-install xcode:
$ sudo rm -rf $(xcode-select -print-path)
$ xcode-select --install
See more: https://github.com/nodejs/node-gyp/issues/569
I managed to solve this by just opening Xcode, going to Preferences -> Locations -> Command Line Tools, and choosing it from the drop-down (it was empty before).
Following these steps helped me to resolve this issue on MacOS
sudo rm -rf $(xcode-select -print-path)
xcode-select --install
/usr/sbin/pkgutil --packages | grep CL
sudo npm install -g node-gyp
Install xcode from(I prefer) https://developer.apple.com/download/more/ or xcode-select --install on terminal.
Then follow in order.
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license
/usr/sbin/pkgutil --packages | grep CL
sudo npm install -g node-gyp

npm install canvas dies with "clang: error: no such file or directory: '{{}'"

I get this error while installing any node packages that run node-gyp rebuild:
SOLINK_MODULE(target) Release/canvas-postbuild.node
clang: error: no such file or directory: '{{}'
make: *** [Release/canvas-postbuild.node] 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.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:810:12)
gyp ERR! System Darwin 14.0.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/arkadiy/node-canvas
gyp ERR! node -v v0.10.33
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
I have npm 1.4.28 and all of /usr/local is chowned to me. clang is recent-ish:
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix
The error is completely ungoogleable (seriously, try it) and I can't even tell where clang is being invoked because the stack trace is only for the callback handler. It seems like a shell substitution/xargs issue almost?
I would say your node/npm install is suspect. If you start from their github
https://github.com/Automattic/node-canvas
and download the repo
git clone https://github.com/Automattic/node-canvas.git
cd node-canvas
npm install .
notice the period in above command - that gets upstream dependencies
I just did this and all is well - if you get errors doing above then I suggest you expunge node/npm and install from source. The following steps give you such a clean node/npm install from source
to start fresh remove prior node and npm installs as well as these :
sudo mv ~/.npmrc ~/.npmrc_ignore
sudo mv ~/.npm ~/.npm_ignore
sudo mv ~/tmp ~/tmp_ignore
sudo mv ~/.npm-init.js ~/.npm-init.js_ignore
download source from : http://nodejs.org/download/
cd node-v0.10.33
define environment variable NODE_PATH as the dir for subsequent module installs
export NODE_PARENT=/some/desired/install/path_goes_here
export NODE_PARENT=/usr/local/bin/nodejs # use this ONLY if you MUST install as root (sudo)
export NODE_PARENT=${HOME}/nodejs-v0.10.33 # use this if you want to install modules as yourself
export PATH=${NODE_PARENT}/bin:${PATH}
export NODE_PATH=${NODE_PARENT}/lib/node_modules
./configure --prefix=${NODE_PARENT}
make
make install
which puts it into dir defined by above --prefix
when you use syntax : npm install -g some_cool_module
the -g for global installs it into dir $NODE_PATH and not your $PWD
IMPORTANT put above three export xxx=yyy
commands into your ~/.bashrc or some such to persist these environment variable changes
Turns out I had a literal LDFLAGS='{} -L/usr/local/opt/openssl/lib' because of something that wasn't being expanded by the shell. Never mind!

npm install <module> persistent error ? (node-gyp build ?)

I try to install jsdom such:
$ sudo npm install -g jsdom
# OR
$ sudo npm install jsdom
After some successfull command, the install quickly fails, with the first error message being after the [....] :
$ sudo npm install jsdom
npm http GET https://registry.npmjs.org/jsdom
npm http 304 https://registry.npmjs.org/jsdom
[....]
> contextify#0.1.7 install /home/yug/Desktop/QGis/WikiAtlas/1_shaded_relief/test/node_modules/jsdom/node_modules/contextify
> node-gyp rebuild
gyp: /home/yug/.node-gyp/0.10.25/common.gypi not found (cwd: /home/yug/Desktop/QGis/WikiAtlas/1_shaded_relief/test/node_modules/jsdom/node_modules/contextify) while reading includes of binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/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.8.0-35-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/yug/Desktop/QGis/WikiAtlas/1_shaded_relief/test/node_modules/jsdom/node_modules/contextify
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm http 304 https://registry.npmjs.org/domhandler
npm http 304 https://registry.npmjs.org/domelementtype
npm ERR! contextify#0.1.7 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the contextify#0.1.7 install script.
npm ERR! This is most likely a problem with the contextify 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 contextify
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.8.0-35-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "jsdom"
npm ERR! cwd /home/yug/Desktop/QGis/WikiAtlas/1_shaded_relief/test
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! code ELIFECYCLE
npm http 304 https://registry.npmjs.org/qs
npm http 304 https://registry.npmjs.org/entities
....
Hint? This bug also appears for other modules :
$sudo npm install -g topojson
#bug with `contextify#0.1.7 install` error as well.
How to fix that ?
Edit: I tried sudo apt-get remove --purge nodejs npm topojson then reinstalling via various ways. Even when nodejs reinstall is successfull, the error stays, so I guess it's rather contextual (node.gyp ? cwd ? ...). Remove/reinstall ways tried :
ubuntu_setup.sh
with native outdated url
with url updated to https://github.com/joyent/node.git,
sudo add-apt-repository ppa:chris-lea/node.js,
and handmade git clone https://github.com/joyent/node.git (trial canceled)
using various other ways :
way1 : ogoing
As you're finding out from the comments, this is a very common issue. So common, in fact, that the authors of jsdom have documented it right in the README file for the project's git repository.
TL;DR
You need to have a C++ compiler and Python2.7 installed on your machine to install contextify which is a dependency of jsdom. Otherwise, the jsdom install will fail.
From the README on the Github page for jsdom:
Contextify
Contextify is a dependency of jsdom, used for running <script> tags within the page. In other words, it allows jsdom, which is run in Node.js, to run strings of JavaScript in an isolated environment that pretends to be a browser environment instead of a server. You can see how this is an important feature.
Unfortunately, doing this kind of magic requires C++. And in Node.js, using C++ from JavaScript means using "native modules." Native modules are compiled at installation time so that they work precisely for your machine; that is, you don't download a contextify binary from npm, but instead build one locally after downloading the source from npm.
Unfortunately, getting C++ compiled within npm's installation system can be tricky, especially for Windows users. Thus, one of the most common problems with jsdom is trying to use it without the proper compilation tools installed. Here's what you need to compile Contextify, and thus to install jsdom:
Windows
A recent copy of the x86 version of Node.js for Windows, not the x64 version.
A copy of Visual C++ 2010 Express.
A copy of Python 2.7, installed in the default location of C:\Python27.
There are some slight modifications to this that can work; for example full versions of Visual Studio usually work, and sometimes you can even get an x64 version of Node.js working too. But it's tricky, so start with the basics!
Mac
XCode needs to be installed
"Command line tools for XCode" need to be installed
Launch XCode once to accept the license, etc. and ensure it's properly installed
Linux
You'll need various build tools installed, like make, Python 2.7, and a compiler toolchain. How to install these will be specific to your distro, if you don't already have them.
Try installing jsdom again after satisfying the requirements mentioned above for your OS, and see if that solves it.
By the way, you are getting the same issue with topojson because it has a dependency on d3 which in turn depends on jsdom, so it is just the same problem installing jsdom. Hope this helps!
--EDIT--
Since it sounds like you're using Ubuntu, I would recommend starting with the following command:
sudo apt-get install build-essential
This will install make and g++ and some other tools. This package and Python2.7 is probably about all you'll need to successfully install contextify.
Seems I found a way by carefully deleting all node-related file and folder on my computer.
0. Context: I previously made several unsuccessful console clean-ups, with
sudo apt-get remove --purge nodejs npm topojson
followed by ~3 different ways to reinstall nodejs. I tried EACH way, from clean-up to reinstall, between 2 & 4 times.
1. Terminal purging: Let's first cleaned up my mess the deepest way possible:
npm cache clean; bower cache clean; grunt clean;
sudo apt-get remove --purge nodejs npm topojson
Yet, I just noticed that this deep purge does NOT purge/delete installed node modules, which stay persistent.
2. Hand purge: Also, I pushed the purge further with an hand purge for both nodejs and node_modules. I looked for ALL related folders on my computer, nearer the root (ubuntu: /home/<user>/) the better. I was careful to delete all previously installed global .../node-modules/ folders, without deleting local modules (specific local installations, which were still working).
3. Reinstall: Then the following consoles allowed a clean reinstall:
sudo apt-get update
sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
sudo npm install -g topojson jsdom
Afterwhat, my file conversion via npm module topojson (depending itself on jsdom) worked fine :
cd /myfolder/
topojson -o output.topo.json input.geo.json
4. Conclusion: I can not identify why, which file/folder deletion allowed the successful sudo apt-get install nodejs + sudo npm install -g topojson reinstall. But thist deep cleanup via mouse and recursive remove sudo rm -r [node related folder/file] definitively unlocked my situation.
/!\ Be very careful with the rm -r recursive remove. /!\
Solution 1b: I [suspect][1] the rm -r /home/<user>/local/lib/node_modules/ to be the key element unlocking the situation. You may list the global (-g) node_modules, then remove the relevant one(s) (topojson and/or jsdom and/or node-gyp) specifically, then reinstall it(them).
Commands: On ubuntu, try...
cd /home/<user>/local/lib/node_modules/ #replace <user> by relevant user name to set your cwd
ls -1 # give the list of global modules names
rm -r /<module_name> #replace <module_name> by relevant name to remove it
sudo npm install -g <module_name> #replace <module_name> by relevant name for global install
Note: topojson depends on jsdom and npm-gyp.
[1]: not tried, but makes sense according to my diagnostic.

NodeJS - Error installing with NPM

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
C:\Windows\system32>npm install caress-server
npm http GET https://registry.npmjs.org/caress-server
npm http 304 https://registry.npmjs.org/caress-server
npm http GET https://registry.npmjs.org/jspack/0.0.1
npm http GET https://registry.npmjs.org/buffertools
npm http 304 https://registry.npmjs.org/jspack/0.0.1
npm http 304 https://registry.npmjs.org/buffertools
> buffertools#2.0.1 install C:\Windows\system32\node_modules\caress-server\node_
modules\buffertools
> node-gyp rebuild
C:\Windows\system32\node_modules\caress-server\node_modules\buffertools>node "G:
\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-
gyp.js" rebuild
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT
HON env variable.
gyp ERR! stack at failNoPython (G:\nodejs\node_modules\npm\node_modules\node
-gyp\lib\configure.js:101:14)
gyp ERR! stack at G:\nodejs\node_modules\npm\node_modules\node-gyp\lib\confi
gure.js:64:11
gyp ERR! stack at Object.oncomplete (fs.js:107:15)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "G:\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\
bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Windows\system32\node_modules\caress-server\node_modules\buffert
ools
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm ERR! buffertools#2.0.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the buffertools#2.0.1 install script.
npm ERR! This is most likely a problem with the buffertools 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 buffertools
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "G:\\nodejs\\\\node.exe" "G:\\nodejs\\node_modules\\npm\\bin\\n
pm-cli.js" "install" "caress-server"
npm ERR! cwd C:\Windows\system32
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Windows\system32\npm-debug.log
npm ERR! not ok code 0
C:\Windows\system32>
I am installing a certain NodeJS script - Caress. But i am not unable to. I am using Windows 8.1, can anyone tell me what is the problem i am facing, and why is this installation not working. There seems to be a problem with the buffertools dependency, thats far as i can think. Dont know how maybe fix this?
If i download the build from github and place it in node-modules, nothing seems to work. when i try to start, using npm start, or during implementation either.
G:\nodejs\node_modules\caress-server>npm install
G:\nodejs\node_modules\caress-server>npm start
> caress-server#0.1.1 start G:\nodejs\node_modules\caress-server
> node examples/server.js
info - socket.io started
module.js:340
throw err;
^
Error: Cannot find module './build/Release/buffertools.node'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (G:\nodejs\node_modules\caress-server\node_modules\buf
fertools\buffertools.js:16:19)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
npm ERR! caress-server#0.1.1 start: `node examples/server.js`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the caress-server#0.1.1 start script.
npm ERR! This is most likely a problem with the caress-server package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node examples/server.js
npm ERR! You can get their info via:
npm ERR! npm owner ls caress-server
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "G:\\nodejs\\\\node.exe" "G:\\nodejs\\node_modules\\npm\\bin\\n
pm-cli.js" "start"
npm ERR! cwd G:\nodejs\node_modules\caress-server
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! G:\nodejs\node_modules\caress-server\npm-debug.log
npm ERR! not ok code 0
G:\nodejs\node_modules\caress-server>
As commented below you may not need to install VS on windows, check this out
https://github.com/nodejs/node-gyp/issues/629#issuecomment-153196245
UPDATED 02/2016
Some npm plugins need node-gyp to be installed.
However, node-gyp has its own dependencies (from the github page):
UPDATED 09/2016
If you're using Windows you can now install all node-gyp dependencies with single command (NOTE: Run As Admin in Windows PowerShell):
$ npm install --global --production windows-build-tools
and then install the package
$ npm install --global node-gyp
UPDATED 06/2018
https://github.com/nodejs/node-gyp/issues/809#issuecomment-155019383
Delete your $HOME/.node-gyp directory and try again.
See full documentation here: node-gyp
NOTE: This is an old answer that applied to earlier versions of NodeJS. My sincere gratitude to these open source projects that responded to this issue and resolved this former pain.
Make sure you have all the required software to run node-gyp:
https://github.com/TooTallNate/node-gyp
You can configure version of Visual Studio used by node-gyp via an environment variable so you can avoid having to set the --msvs_version=2012 property every time you do an npm install.
Examples:
set GYP_MSVS_VERSION=2012 for Visual Studio 2012
set GYP_MSVS_VERSION=2013e (the 'e' stands for FREE 'express edition')
For the full list see
https://github.com/joyent/node/blob/v0.10.29/tools/gyp/pylib/gyp/MSVSVersion.py#L209-294
This is still painful for Windows users of NodeJS as it assumes you have a copy of Visual Studio installed and many end users will never have this. So I'm lobbying Joyent to the encourage them to include web sockets as part of CORE node and also to possible ship a GNU gcc compiler as part of NodeJS install so we can permanently fix this problem.
Feel free to add your vote at:
https://github.com/joyent/node/issues/8005#issuecomment-50545326
I encountered the issue with the error:
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
Here is what I was doing and what finally worked.
Disclaimer: I am just getting my hands into Node, Angular after many years in the Java, Linux world among others...
Environment Description: Windows 8.1 64-bit; Cygwin; cygwin bash shell
Command used that led to error: npm install -g karma
Error:
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT
HON env variable.
Discovery: 'which python' on bash shell clearly shows '/usr/bin/python'. Now that is annoying!
Solution: This is only applicable to those using the environment similar to what I have, i.e. using cygwin and bash shell. Hope it helps in other environments as well but keep in mind that your kettle of tea may look a little different than mine.
Firstly, need to set the $PYTHON shell env variable in .bashrc using the explicit windows path to the python executable and not the unix like root path (/usr/bin) used by cygwin.
Secondly, and this one took a lot of trial/error and here's the gotcha! Cygwin installs python under /usr/bin (which is really a mirror of /bin on windows) with the version, i.e. (in my system) /usr/bin/python2.7.exe and then adds a link /usr/bin/python --> python2.7.exe. The problem is that gyp cannot follow this link and keeps giving the annoying error that it cannot find python even though you can find it just fine from the shell command line.
With the above background now add the following line to your .bashrc
export PYTHON="C:/cygwin64/bin/python2.7.exe (or whatever is the version on your system)"
Now source your .bashrc from your home directory (on cygwin)--> 'source .bashrc'
You should be fine now and gyp will find the python executable.
I hope this helps someone stumbling on the same or similar issue.
should be able get all node-gyp dependencies with chocolatey for Windows
choco install python2
choco install visualstudioexpress2013windowsdesktop
Setup JavaScript Environment
1. Install Node.js
Download installer at NodeJs website. You can download the latest V6
2. Update Npm
Npm is installed together with Node.js. So don't worry.
3. Install Anaconda
Anaconda is the leading open data science platform powered by Python. The open source version of Anaconda is a high performance distribution of Python. It can help you to manage your python dependency. You can use it to create different python environment in the futher if you want to touch with it.
Node-gyp only support >= Python 2.7 and < Python 3.0
So just install the 2.7 version
4. Install Node-gyp
You can install with npm:
$ npm install -g node-gyp
You will also need to install:
On Windows:
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.
💡 [Windows Vista / 7 only] requires .NET Framework 4.5.1
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.
If you have multiple Python versions installed, you can identify which Python version node-gyp uses by setting the '--python' variable:
$ node-gyp --python C:/Anaconda2/python.exe
If node-gyp is called by way of npm and you have multiple versions of Python installed, then you can set npm's 'python' config key to the appropriate value:
$ npm config set python C:/Anaconda2/python.exe
Future update for Node.js and npm
Download installer from their official website and direct install it. The installer will automatic help you to remove old files.
npm update npm
Future update for Python
conda update --all
Fixed with downgrading Node from v12.8.1 to v11.15.0 and everything installed successfully
gyp ERR! configure error gyp ERR! stack Error: Can't find Python
executable "python", you can set the PYT HON env variable.
This means the Python env. variable should point to the executable python file, in my case:
SET PYTHON=C:\work\_env\Python27\python.exe
For Cygwin users:
The python issue with using npm on an out-of-the-box Cygwin installation, is that node-gyp is giving a misleading error due to incomplete checking in the ../npm/node_modules/node-gyp/lib/configure.js code.
It's due to how Cygwin treats symbolic links. It doesn't do that properly in an out-of-the box installation. So the error messages from the above code become misleading, as it complains about the PYTHON path and not the existence of python.exe (or link of) file itself.
There are (at least) 2 ways to resolve this.
Installing the Cygwin package cygutils-extra and use winln.
Use native Windows CMD in Admin mode.
For (1) you can create a proper symlink from within Cygwin shell by doing these steps:
# To make the Cygwin environment treat Windows links properly:
# Alternatively add this to your `.bashrc` for permanent use.
export CYGWIN=winsymlinks:nativestrict
# Install Cygwin package containing "winln"
apt-cyg install cygutils-extra
# Make a proper Windows sym-link:
cd /cygdrive/c/cygwin64/bin/
winln.exe -s python2.7.exe python.exe
# Add PYTHON as a native Windows system wide variable (HKLM)
setx /M PYTHON "C:\cygwin64\bin\python"
(Also assuming you are running the Cygwin shell as Admin.)
Using apt-cyg is recommended and can be found in various forms on github.
For (2) the resolution for out-of-the-box Cygwin users is this:
# Open a native Windows CMD in Administrator mode and:
cd C:\cygwin64\bin\
mklink python.exe python2.7.exe
The result should look like this:
C:\cygwin64\bin>ls -al python*
lrwxrwxrwx 1 xxx xxx 13 Jun 2 2015 python -> python2.7.exe
lrwxrwxrwx 1 Administrators xxx 13 Aug 24 17:28 python.exe -> python2.7.exe
lrwxrwxrwx 1 xxx xxx 13 Jun 2 2015 python2 -> python2.7.exe
-rwxr-xr-x 1 xxx xxx 9235 Jun 2 2015 python2.7.exe
For windows
Check python path in system variable.
npm plugins need node-gyp to be installed.
open command prompt with admin rights, and run following command.
npm install --global --production windows-build-tools
npm install --global node-gyp
I was working on an old Vue 2.x project, at least 2 years old and deps were never updated. Reverting to Node v10.16.3 worked for me. Versions 14 and 12 did not work.
for me the solution was:
rm -rf ~/.node_gyp and
sudo npm install -g node-gyp#3.4.0
cd /usr/local/lib sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.5.dylib
brew install gcc
npm install
I was installing appium by npm install -g appium and getting the same error on Windows 10.
Below command worked for me:
npm --add-python-to-path='true' --debug install --global windows-build-tools
https://github.com/felixrieseberg/windows-build-tools/issues/33
The question is already answered but these were not working in my case which is alpine Linux based OS so maybe this helps someone else.
I was also getting same error
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
So fix by single line just add this if you are working in Dockerfile or install it in OS
apk add --no-cache python nodejs
in ubuntu
sudo apt-get install python3.6
Note: Node version:8
install node-gyp and c++ compiler (gcc-c++).
npm install --global --production windows-build-tools

Resources