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
Related
I have a NPM project that uses bufferutils and utf-8-validate, both requiring node-gyp to install them. When I do npm install, I get following error:
> bufferutil#1.2.1 install C:\Users\Marek\WEB\moje-skoly\web-app\node_modules\bufferutil
> node-gyp rebuild
C:\Users\Marek\WEB\moje-skoly\web-app\node_modules\bufferutil {git}{hg}
{lamb} if not defined npm_config_node_gyp (node "C:\Users\Marek\AppData\Roaming\npm\node_modules\npm\bin\node-g
yp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
bufferutil.cc
C:\Users\Marek\.node-gyp\5.1.1\include\node\v8.h(18): fatal error C1083: Cannot open include file: 'stddef.h':
No such file or directory [C:\Users\Marek\WEB\moje-skoly\web-app\node_modules\bufferutil\build\bufferutil.vcx
proj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\Marek\AppData\Roaming\npm\node_modules\npm\node_modules\nod
e-gyp\lib\build.js:276:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Marek\\AppData\\Roaming\\npm\\node_modules\\
npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Marek\WEB\moje-skoly\web-app\node_modules\bufferutil
gyp ERR! node -v v5.1.1
gyp ERR! node-gyp -v v3.2.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
Previously it failed because of Python 2.7 not installed, now it is this. It's causing me headaches. What should I do about this?
The answer below stands for a manual installation, but there is a much simpler way : the automatic install.
Open Powershell as admin and run npm install -g windows-build-tools.
The install takes time but it worked like a charm for me !
I found this brilliant solution on GitHub:
Your OS MUST be Windows
Check that python is in your path by writting python --version in the console. If not then
Download python 2.7 (I recommend chocolatey (choco install python2 -y)) and add python.exe to your PATH variable.
Aren't you on Windows 7? Skip 5 and 6.
Check that you have .NET 4.5.1+ installed. If not then
Download and install .NET 4.5.1 (.NET 4.5.2 will also work just fine)
Download Microsoft Visual C++ Build Tools 2015 Technical Preview
Use custom install. Install the Windows 8.1 SDK if you haven't already. Apparently, it doesn't matter what OS you're on. You just need the Windows 8.1 SDK.
Set the npm config variable msvs_version to 2015: npm config -g set msvs_version 2015
Do npm i in what-ever project with node-gyp as a dependency without seeing weird error messages
My nightmares are gone!
I couldn't find my solution anywhere else, so thought I'd share.
Running node v10.16.3 on Windows 10
Install windows-build-tools -
npm install --global --production windows-build-tools
Set the python path explicitly in C:\Users[your username].npmrc - In my case, this is like so:
python=c:\users\akeel\.windows-build-tools\python27\python
Started Working For Me
Nothing work for me (installed msvs_version 2017,2015)
Noticed
node-gyp error comes from python path and msvsc path
npm config list
Output (set correct installed path and msvs)
; cli configs
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.12.0 node/v12.9.0 win32 ia32"
; userconfig C:\Users\balaji\.npmrc
init-author-name = "Balaji"
init-license = "MIT"
msvs_version = "2017"
node_gyp = "C:\\Users\\balaji\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js"
python = "C:\\Users\\balaji\\.windows-build-tools\\python27/python.exe"
; globalconfig C:\Users\balaji\AppData\Roaming\npm\etc\npmrc
; builtin config undefined
prefix = "C:\\Users\\balaji\\AppData\\Roaming\\npm"
; node bin location = C:\Program Files (x86)\nodejs\node.exe
; cwd = G:\all clients project\2020\anware
; HOME = C:\Users\balaji
; "npm config ls -l" to show all defaults.
To Set globaly(eg)
npm config -g set msvs_version 2015
To Set localy (eg)
npm config set msvs_version 2015
Path correction
npm config set python /path/to/executable/python
for those who Not installed yet(it install msvsc and python)
npm install -g windows-build-tools
after install check above givn tips such as path and version everything
happy coding....
detail info updated
https://stackoverflow.com/a/68630586/11624647
I was having this issue when updating from an older version of node to node v12. There was a particular issue with bcrypt library. I just uninstalled v12 and installed v10 and everything worked.
Found a solution here: https://spin.atomicobject.com/2019/03/27/node-gyp-windows/
I had to install Windows Build Tools 2015 and then set Node to use it.
Here are the commands I've used:
npm install --global --production windows-build-tools --vs2015
npm config set msvs_version 2015 –global
Using WSL works for me (windows 10 users only)
those who dont know what WSL is simply Linux command shell in windows
just follow this guide to install WSL https://wiki.ubuntu.com/WSL
and install nodejs and npm my using commands
sudo apt-get install nodejs npm -y
When I try to run npm-install I get:
npm ERR! Windows_NT 6.3.9600 npm ERR! argv "C:\Program Files
(x86)\nodejs\node.exe" "C:\Program Files (x8
6)\nodejs\node_modules\npm\bin\npm-cli.js" "install" npm ERR!
node v4.0.0 npm ERR! npm v2.14.2 npm ERR! code ELIFECYCLE
npm ERR! v8-debug#0.4.6 install: node-pre-gyp install
--fallback-to-build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the v8-debug#0.4.6 install script 'node-pre-gyp install --fal
lback-to-build'. npm ERR! 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 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:_Src\Personal\rzaleski\ILikeThis\npm-debug.log
I tried a number of things (installing VS C++ redistrib, npm install --msvs_version=2013, etc). Nothing seems to work.
Do you have any ideas how I can find out the actual error (the log is a bit daunting).
UPDATE: What I ended up doing was reverting from Node v4.0.0 to NODE v0.12. This is not really a fix to the issue, but it got me around my issues.
Go to: (http://www.devdocs.io) look # the npm section. Must use desktop, must use windows if possible (Mac layout is weird for some reason) Follow the steps detailed for "resetting npm cache"
Node-gyp is a P.I.T.A. and often blows up installs among other things. I have a horrible time with it every time I come back to an environment I haven't used in a while and try to use it again.
Alternatively, you can uninstall node, and attempt to reinstall using chocolatey if you're on windows or brew if you're on a mac. Make sure you sudo commands when installing to mac.
You're most likely going to have to clean out the npm cache, possibly reinstall nodejs, and possibly reinstall node-gyp.
NOTE: Before you go about the above mentioned steps, first make sure that your configurations are compatible, including your python version for node-gyp. (https://www.npmjs.com/package/node-gyp) Also, I have solved the C++ redistributable issues several times without touching anything C++ related, just so you know this error is not indicative of C++, but rather local settings and compatible software versions that interact with node + npm NOT C++ related (for instance, your python version interacting with node-gyp)
There is no straightforward "run this and that" to fix, you kind of have to muddle through it, and I can promise you that you'll have to do it more than once. But the more you fix node + npm + node-gyp, the more able you will be to quickly remedy all issues in the future. The links above should sort you out no problem though. Just walk through them slowly and thoroughly as instructed.
All i did is uninstall node and install it again, and during the installation, check the box telling you to install the needed dependencies and complete your installation.
If it persists, locate the package that is causing this error and install it seperately.
Example:
npm install -g node-gyp
npm install bcrypt
I am trying to set up a chrome extension that will automatically save the changes I make to my website with the inspect element feature. The idea is that you'll be able to make real time changes to the website without having to go back into the ide to save the changes and re-upload and everything. The extension is called DevTools Autosave. I've been following the instructions from this site. I'm trying to install this on a mac.
I've installed node.js and the extension already. When I got to the part in the instructions where it talks about which commands to run in the terminal I've tried both with and without the "sudo" in front of the "npm install -g autosave" command but I always get this error:
Error: EACCES, permission denied
at Function.startup.resolveArgv0 (node.js:815:23)
at startup (node.js:58:13)
at node.js:906:3
npm ERR! autosave#1.0.3 install: `node ./scripts/install.js`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the autosave#1.0.3 install script.
npm ERR! This is most likely a problem with the autosave package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./scripts/install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls autosave
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" "-g" "autosave"
npm ERR! cwd /Users/Brent
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0
Anyone know how I can fix this? I can't find anyone that is having this problem and I've been on a few different forums now but can't find a solution. Thanks in advance.
You have two options: Either fix your npm setup, so you can use npm -g, or install autosave locally.
To install locally (i.e. in node_modules within your current directory), run npm install autosave (without -g). Then you can run ./node_modules/.bin/autosave or ./node_modules/autosave/bin/autosave to start autosave.
To fix your npm setup, so you can use -g without root permissions (recommended):
In your home dir (assuming /Users/Brent/), create a file called .npmrc with the following content:
cache = /Users/Brent/.npm/cache
globalconfig = /Users/Brent/.npm/npmrc
globalignorefile = /Users/Brent/.npm/npmignore
prefix = /Users/Brent/.npm
And add ~/.npm/lib/node_modules to your NODE_PATH, e.g. by putting the following in .bashrc (assuming that your shell is bash) to allow the modules to be found, and append ~/.npm/bintoPATHso you can run any installed binary (i.e. runautosave` from anywhere):
export NODE_PATH=$HOME/.npm/lib/node_modules
export PATH=$PATH:$HOME/.npm/bin
(changes to .bashrc only take effect when you load the shell, or use . ~/.bashrc; if you want to use the new setup without reloading the shell, just run that line (export ...) in your current shell).
As of 2020, here is the recommended solution by npm. It worked for me (OSX). (No need to change any path configuration or .bashrc)
Steps:
Install nvm by running below command.
If you are using bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
If you are using zsh
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | zsh
Install node using nvm (No need to uninstall existing node/npm)
nvm install 12.13.1
While using npm to install packages I've recently had an issue where errors pop up that Node can't find modules/scripts. For some reason it's looking in my C:/ directory, and not C:/my-project/node_modules. This library in particular has been troublesome, but I have seen this happen before too.
I'm running Win7 x32 with v0.10.35 of Node.
This is an example of what I see when I try to install node-sass:
C:\node\test>npm install node-sass
> node-sass#2.0.0-beta install C:\node\test\node_modules\node-sass
> node scripts/install.js
module.js:340
throw err;
^
Error: Cannot find module 'C:\scripts\install.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:929:3
npm ERR! node-sass#2.0.0-beta install: `node scripts/install.js`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the node-sass#2.0.0-beta install script.
npm ERR! This is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node scripts/install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls node-sass
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\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "node-sass"
npm ERR! cwd C:\node\test
npm ERR! node -v v0.10.35
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0
A coworker sent me his install.js file, and I placed it in my root just to see what happens. Unfortunately the installation still fails once npm tries to install modules that the root module requires.
I ran into a similar problem while trying to install node-sass onto my Windows system. I reported this as a node-sass issue (see Windows 8.1 Pro 64-bit: gulp-sass install failing due to node-sass#2.1.1 install script failure).
I added some additional logging to my local install of node to see what is actually going on and discovered the following:
nodejs\node_modules\npm\lib\utils\spawn.js is used to start scripts\install.js
By adding some additional logging, I discovered that spawn.js is using the following command line to start install.js: C:\WINDOWS\system32\cmd.exe /c node scripts/install.js
In a separate command prompt window, I changed to my c:\test directory and I ran C:\WINDOWS\system32\cmd.exe /c node to see which directory node is using.
At the node > prompt, I ran process.cwd(). This displayed: c:\\ and not c:\\test
When I saw c:\\ above, I remembered that I added an Autorun setting to HKEY_CURRENT_USER\Software\Microsoft\Command Processor in my Windows registry to automatically run a start up script every time cmd.exe is started. And when I looked at my start up script, I noticed that the last command in that script is: cd c:\. This causes every instance of cmd.exe to use c:\ as its starting directory.
After removing cd c:\ from my start up script, npm install node-sass ran correctly.
I hope this is helpful to others who have run into the issue described in the question above.
I wonder if your 'prefix' configuration variable is set. You can find out by running
> npm c get prefix
It should be set to something reasonable for global packages; if it is set to "C:\" then that may be causing your problem.
You can find out where npm is looking for configuration by running
> npm c get globalconfig
> npm c get localconfig
And you can list all the configuration variables
> npm c ls -l
Windows 7 (64)
npm version 1.3.24
node version 0.10.25
When I am trying to install bower I am getting this error message
C:\>npm install bower -g
npm http GET https://registry.npmjs.org/bower
npm ERR! cb() never called!
npm ERR! not ok code 0
I already tried
npm cache clean
and
npm install - getting another error message
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\andpon>cd/
C:\>npm install
npm ERR! install Couldn't read dependencies
npm ERR! package.json ENOENT, open 'C:\package.json'
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directo
ry.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd C:\
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! path C:\package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\npm-debug.log
npm ERR! not ok code 0
Can any one know solution for this problem
Thanks
I found an entry in a blog that resolved the issue in the following easy way by creating a symbolic link:
For anyone wishing to still use their OS's package of node the simple solution for this is to determine where node is installed on your OS and then create a symbolic link.
For example I had the issue on ubuntu and the install directory is /usr/bin. To create the symlink you can run:
sudo ln -s /usr/bin/nodejs /usr/bin/node
in windows you can use the mklink command.. Be sure to open the command prompt as a administrator
I also got this error. I checked a page showing the response time of the npm registry. It was showing a bit slower response time than normally (around 1700ms 21st of March 2015) so I tried again a few hours later and then it worked.
I did not change any settings or update anything in the mean time so I guess it was some sort of timeout somewhere that caused the error.
I got same error and I fixed it by installing Windows SDK.
If you have visual studio installed you can try to do following thing to install windows SDK:
Go to control panel -> Programs -> uninstall programs -> right click Visual Studio NNNN installer and select"change. It will open visual studio installer and you can modify and select which components you want to install/uninstall. Make sure that you select C++ stuff, it should contain Windows SDK.
If you dont have then you need to download SDK from internet and install it.
Later I also needed to install Python 2.7 to be able to install some npm packages...
Have a try on yarn.
I have tried many method to solve the issue, but the error is not solved yet.
And I tried yarn, it works for me.