Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
C:Windowssystem32>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:Windowssystem32node_modulescaress-servernode_
modulesbuffertools
> node-gyp rebuild
C:Windowssystem32node_modulescaress-servernode_modulesbuffertools>node "G:
nodejsnode_modulesnpmbinnode-gyp-bin\....node_modulesnode-gypbinnode-
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:nodejsnode_modulesnpmnode_modulesnode
-gyplibconfigure.js:101:14)
gyp ERR! stack at G:nodejsnode_modulesnpmnode_modulesnode-gyplibconfi
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:Windowssystem32node_modulescaress-servernode_modulesbuffert
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:Windowssystem32
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:Windowssystem32npm-debug.log
npm ERR! not ok code 0
C:Windowssystem32>
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:nodejsnode_modulescaress-server>npm install
G:nodejsnode_modulescaress-server>npm start
> caress-server@0.1.1 start G:nodejsnode_modulescaress-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:nodejsnode_modulescaress-servernode_modulesbuf
fertoolsbuffertools.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:nodejsnode_modulescaress-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:nodejsnode_modulescaress-servernpm-debug.log
npm ERR! not ok code 0
G:nodejsnode_modulescaress-server>
asked Jan 26, 2014 at 16:00
![]()
2
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=2012for 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
answered Aug 1, 2014 at 1:49
![]()
Tony O’HaganTony O’Hagan
21k3 gold badges64 silver badges73 bronze badges
1
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.
Preview
34.9k10 gold badges90 silver badges112 bronze badges
answered Aug 4, 2015 at 22:23
![]()
AndyAndy
1191 silver badge5 bronze badges
1
should be able get all node-gyp dependencies with chocolatey for Windows
choco install python2
choco install visualstudioexpress2013windowsdesktop
answered Mar 15, 2016 at 20:54
![]()
tarikakyoltarikakyol
5137 silver badges13 bronze badges
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-toolsfrom 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
answered Sep 22, 2016 at 9:10
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_envPython27python.exe
answered Aug 16, 2016 at 15:07
![]()
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-extraand usewinln. - 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:cygwin64binpython"
(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:cygwin64bin
mklink python.exe python2.7.exe
The result should look like this:
C:cygwin64bin>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
answered Aug 24, 2016 at 16:05
emigenixemigenix
1011 silver badge4 bronze badges
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
answered Nov 17, 2017 at 9:07
0
Fixed with downgrading Node from v12.8.1 to v11.15.0 and everything installed successfully
answered Aug 21, 2019 at 16:35
![]()
MakMak
19.5k5 gold badges25 silver badges32 bronze badges
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.
answered Jul 13, 2021 at 19:10
![]()
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
answered Jan 4, 2017 at 8:02
OrrOrr
4,6402 gold badges27 silver badges30 bronze badges
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
answered Jan 3, 2018 at 8:54
![]()
AdiiiAdiii
50.9k6 gold badges132 silver badges135 bronze badges
install node-gyp and c++ compiler (gcc-c++).
answered Mar 27, 2018 at 0:24
![]()
2
npm install —global —production windows-build-tools
answered Feb 25, 2021 at 19:13
![]()
I am trying to globally install an npm module I just published. Every time I try to install, either from npm or the folder, I get this error.
npm ERR! Error: ENOENT, chmod '/usr/local/lib/node_modules/takeapeek/lib/cmd.js'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR! System Linux 3.8.0-19-generic
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "takeapeek"
npm ERR! cwd /home/giodamlio
npm ERR! node -v v0.10.6
npm ERR! npm -v 1.3.6
npm ERR! path /usr/local/lib/node_modules/takeapeek/lib/cmd.js
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/giodamlio/npm-debug.log
npm ERR! not ok code 0
I am using sudo and I have triple checked everything in the package everything should work. I did some searching around, and saw a couple of similer cases none of which have been resolved. Here is what I tried.
- Upgrade npm (
sudo npm install -g npm) - Clear the global npm cache (
sudo npm cache clear) - Clear the user npm cache (
npm cache clear)
I noticed that the error had to do with the file I am linking to the path, specifically when npm tried to do a chmod. That shouldn’t be a problem, my lib/cli.js has normal permissions, and npm has superuser permissions during this install.
After digging through the npm docs I found an option that would stop npm from making the bin links(--no-bin-links), when I tried the install with it, it worked fine.
So what’s the deal? Is this some weird fringe case bug that has no solution yet?
Edit: For reference, here is the module I uploaded
mikemaccana
103k93 gold badges371 silver badges469 bronze badges
asked Aug 1, 2013 at 9:49
9
Ok it looks like NPM is using your .gitignore as a base for the .npmignore file, and thus ignores /lib. If you add a blank .npmignore file into the root of your application, everything should work.
A better, more explicit approach is to use an allow-list rather than a disallow-list, and use the «files» field in package.json to specify the files in your package.
[edit] — more info on this behaviour here: https://docs.npmjs.com/cli/v7/using-npm/developers#keeping-files-out-of-your-package
answered Aug 2, 2013 at 15:03
badsyntaxbadsyntax
9,2553 gold badges45 silver badges65 bronze badges
10
I ran into a similar problem,
npm cache clean
solved it.
![]()
Uri Agassi
36.5k13 gold badges76 silver badges93 bronze badges
answered May 3, 2014 at 15:06
GenjuroGenjuro
7,2657 gold badges39 silver badges61 bronze badges
2
This problem somehow arose for me on Mac when I was trying to run npm install -g bower. It was giving me a number of errors for not being able to find things like graceful-fs. I’m not sure how I installed npm originally, but it looks like perhaps it came down with node using homebrew. I first ran
brew uninstall node
This removed both node and npm from my path. From there I just reinstalled it
brew install node
When it completed I had node and npm on my path and I was able to run
rm -rf ~/.npm
npm install -g bower
This then installed bower successfully.
Updating the brew formulas and upgrading the installs didn’t seem to work for me, I’m not sure why. The removal of the .npm folder was something that had worked for other people, and I had tried it without success. I did it this time just in case. Note also that neither of the following solved the problem for me, although it did for others:
npm cache clean
sudo npm cache clean
answered Jan 9, 2014 at 23:52
user1978019user1978019
2,8081 gold badge28 silver badges37 bronze badges
0
I encountered similar behavior after upgrading to npm 6.1.0. It seemed to work once, but then I got into a state with this error while trying to install a package that was specified by path on the filesystem:
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
The following things did not fix the problem:
rm -rf node_modulesnpm cache clean(gavenpm ERR! As of npm@5, the npm cache self-heals….use 'npm cache verify' instead.)npm cache verifyrm -rf ~/.npm
How I fixed the problem:
rm package-lock.json
answered Jul 12, 2018 at 12:50
IanIan
10.8k2 gold badges35 silver badges57 bronze badges
I was getting this error on npm install and adding .npmignore did not solve it.
Error: ENOENT, stat ‘C:UsersMy-UserNameAppDataRoamingnpm’
I tried going to the mentioned folder and it did not exist.
The error was fixed when I created npm folder in Roaming folder.
This is on Windows 8.1
answered Nov 15, 2014 at 23:08
I had the same problem, and just found a handling not mentioned here. Though I’d contribute to the community:
npm install -g myapp was not copying the bin directory. I found this to be because I did not include it in the files in my package.json
"files": [
"lib",
"bin" // this was missing
]
answered Jun 11, 2015 at 0:26
![]()
dthreedthree
19.2k14 gold badges75 silver badges105 bronze badges
3
Delete package-lock.json file then run npm install
answered Apr 13, 2021 at 6:00
![]()
ClarkClark
1391 silver badge11 bronze badges
I was getting a similar error on npm install on a local installation:
npm ERR! enoent ENOENT: no such file or directory, stat '[path/to/local/installation]/node_modules/grunt-contrib-jst'
I am not sure what was causing the error, but I had recently installed a couple of new node modules locally, upgraded node with homebrew, and ran ‘npm update -g’.
The only way I was able to resolve the issue was to delete the local node_modules directory entirely and run npm install again:
cd [path/to/local/installation]
npm rm -rdf node_modules
npm install
answered Dec 31, 2015 at 0:40
g.careyg.carey
6807 silver badges6 bronze badges
I have a similar problem specifucally :
ERR! enoent ENOENT: no such file or directory, chmod ‘node_modules/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/bin/sshpk-conv
I tried all above solutions but no luck.
I was using vagrant box, and the project was in a shared folder. The problems seems to be only there, when I move the project to another not shared folder (woth host), voila! problem solved.
Just in case another person was using also vagrant
answered Mar 2, 2017 at 21:05
1
I got the simple solution, just clear the npm cache.
sudo npm cache clear --force
then remove the node_modules & package-lock.json
sudo rm -rf node_modules
sudo rm -rf package-lock.json
Now install the dependencies module using npm and start the server
npm install && npm start
answered Jul 17, 2021 at 2:38
![]()
I got a similar error message when trying to npm install a bunch of dependencies. Turns out some of them fail to install on Debian/Ubuntu because they expect /usr/bin/node to be the node executable. To fix, you need do
sudo ln -s nodejs /usr/bin/node
or better yet,
sudo apt-get install nodejs-legacy
For more info: https://stackoverflow.com/a/21171188/7581
answered Feb 19, 2015 at 6:26
itsadokitsadok
28.5k29 gold badges124 silver badges170 bronze badges
I got this error while trying to install a grunt plugin. i found i had an outdated version of npm and the error went away after updating npm to the latest version
npm install -g npm
answered Apr 4, 2015 at 16:13
![]()
Prabhu MurthyPrabhu Murthy
8,9615 gold badges28 silver badges36 bronze badges
I think your compiled coffee script is missing from the published npm package. Try writing a prepublish command.
answered Aug 1, 2013 at 23:34
leewayleeway
4751 gold badge3 silver badges8 bronze badges
2
In my case (multiple code ENOENT errno 34) problem was with ~/.npm/ directory access. Inside it there were some subdirs having root:root rights, which were causing problems while I run commands as normal user (without sudo). So I changed ownership of all subdirs and files inside ~/.npm/ dir into my local user and group. That did the trick on my Ubuntu (on Mac should work too).
$ sudo chown yourusername.yourgroupname ~/.npm/ -R
You should know your user name, right? If no then run $ whoami and substitute your group name with it too, like this:
$ sudo chown johnb.johnb ~/.npm/ -R
EDIT:
Test case:
From my local account /home/johnb I npm-installed globally some generator for yeoman, like this:
$ sudo npm install -g generator-laravel
Problem nature:
Above action caused some dependencies being installed inside ~/.npm/ dir, having root:root ownership (because of sudo ...). Evidently npm does not run as local user (or change dependencies subdirs ownership afterwards) when pulling dependencies and writing them to a local user subdir ~/.npm/.
As long as npm would be so careless against fundamental unix filesystem security issues the problem would reoccur.
Solution:
-
Continuosly check if
~/.npm/contains subdirs with ownership (and/or permissions) other than your local user account, especially when you install or update something withsodo(root). If so, change the ownership inside~/.npm/to a local user recursively. -
Ask
npm, bower, grunt, ...community that they address this issue as I described it above.
answered May 28, 2014 at 22:10
Had a similar Issue but I was in wrong directory please cross check the path of thee file & the run npm start
answered May 2, 2022 at 3:01
1
I tried all the stuff I found on the net (npm cache clear and rm -rf ~/.npm), but nothing seems to work. What solved the issue was updating node (and npm) to the latest version. Try that.
answered May 24, 2014 at 16:49
Nikola M.Nikola M.
5736 silver badges16 bronze badges
In Windows I had a similar error.
Search paste App Data and search for the string npm.
I replaced the string 'npm' (including quotes) with 'npm.cmd' in both atlasboardlibpackage-dependency-manager.js and atlasboardlibclicommands.js. That fixed the problem.
Bob Gilmore
11.9k13 gold badges50 silver badges53 bronze badges
answered Oct 27, 2014 at 17:20
The same error during global install (npm install -g mymodule) for package with a non-existing script.
In package.json:
...
"bin": {
"module": "./bin/module"
},
...
But the ./bin/module did not exist, as it was named modulejs.
answered Nov 3, 2014 at 12:40
hg.hg.
3241 silver badge13 bronze badges
0
- Install latest version of node
- Run: npm cache clean
- Run: npm install cordova -g
answered Jan 10, 2017 at 3:29
You can get this error if your node.js is corrupted somehow as well. I fixed this error by uninstall/restart/install node.js completely and it fixed this error, along with the three other mysterious errors that are thrown.
answered May 26, 2018 at 4:04
Be careful with invalid values for keys «directories» and «files» in package.json
If you start with a new application, and you want to start completely blank, you have to
either start in a complete empty folder or have a valid package.json file in it.
If you do not want to create a package.json file first, just type: npm i some_package
Package with name «some_package» should be installed correctly in a new sub folder «node_modules».
If you create a package.json file first, type: npm init
Keep all the defaults (by just clicking ENTER), you should end up with a valid file.
It should look like this:
{
"name": "yourfoldername",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"author": "",
"license": "ISC"
}
Note that the following keys are missing: «directories«, «repository» and «files«. It looks like if you use incorrect values for «directories» and/or «files«, you are not able to install the package. Leaving these keys out, solved the issue for me.
Also note key «main«. This one is present, but it does contain an invalid value. No file «index.js» exists (yet). You can safely remove it.
Now type: npm i some_package
and package with name «some_package» should be installed correctly in a new sub folder «node_modules».
answered Oct 16, 2018 at 13:16
![]()
RWCRWC
4,4292 gold badges20 silver badges26 bronze badges
Had a similar error with npm in a docker container for webpack. The issue was caused by the —user command line argument of docker run, because the given user and group in there somehow messed up the rights on the local volume. Hope this helps someone 🙂
answered Mar 16, 2020 at 21:28
HajoHajo
8596 silver badges21 bronze badges
Tried nearly everything then finally this:
Simply remove node_modules then run 'npm install' again
answered May 3, 2020 at 15:08
![]()
Alex StephensAlex Stephens
2,9071 gold badge35 silver badges41 bronze badges
I had the same problem on ubuntu, and got rid of the problem by closing the terminal and opening a new one.
answered Mar 3, 2021 at 11:50
1
It’s because there is no package.json and only package-lock.json
Try: npm init —yes
answered Jul 3, 2021 at 18:14
RachelRachel
892 silver badges8 bronze badges
I had a similar issue with a different cause: the yo node generator had added "files": ["lib/"] to my package.json and because my cli.js was outside of the lib/ directory, it was getting skipped when publishing to npm.
(Yeoman issue at https://github.com/yeoman/generator-node/issues/63 it should be fixed soon.)
answered Nov 6, 2014 at 16:51
Nathan FriedlyNathan Friedly
7,7693 gold badges39 silver badges59 bronze badges
I was getting the error «Error: ENOENT, stat ‘C:UsersuserNameAppDataRoamingnpm’. But there was no such directory. Created the directory and the npm install started working
answered Jan 29, 2015 at 2:39
I recently upgraded to node 4.2.1 on a Windows 7 x64 machine. When running
npm install -g bower
I got a similar error:
npm ERR! enoent ENOENT: no such file or directory, open ‘C:UsersTHE_USERNAMEAppDataLocalTempnpm-THE_HASH’
Thinking it was related to the AppData path, I played around with
npm config edit
and
npm config edit --global
to change the prefix, cache and tmp fields but received the same error with the new paths:
npm ERR! enoent ENOENT: no such file or directory, open ‘C:UsersTHE_USERNAMEnpm-tempnpm-THE_HASH’
All commands were run as Administrator, so I had full permissions.
Then I thought there were some issues with existing files so I ran:
npm cache clean
But got the same error. However, there were still some temp files lying around. Manually removing all temp data with cygwin finally fixed the problem for me:
rm -rf bower bower.cmd node_modules etc
If you only have Windows cmd, you could use something like
rmdir /S THE_TEMP_DIR
to remove all subdirectories (although if you have deeply nested node dependencies, this is notoriously problematic)
So, maybe there is some issues with upgrading npm and having versions of bower or other packages hanging around. In my case that seemed to be the problem
answered Oct 30, 2015 at 16:45
![]()
While installing ionic I got below error
115648 error enoent ENOENT: no such file or directory, rename
‘C:UsersUserNameAppDataRoamingnpmnode_modules.stagingansi-b11f0c4b’
-> ‘C:UsersUserNameAppDataRoamingnpmnode_modulesionicnode_modulescordova-libnode_modulesansi’
There was no folder called ansi at that path. I created it there and it installed correctly.
answered Jan 6, 2017 at 17:50
![]()
0
If you tried to «make install» in your project directory with this error you can try it:
rm -rf ./node_modules
npm cache clear
npm remove sails
then you can try to «make install»
If you have the «npm ERR! enoent ENOENT: no such file or directory, chmod ‘…/djam-backend/node_modules/js-beautify/js/bin/css-beautify.js'» then you can try to install some previous version of the js-beautify, more comments: https://github.com/beautify-web/js-beautify/issues/1247
"dependencies": {
...
"js-beautify": "1.6.14"
...
}
and the run «make install». It seem works in case if you have not other dependencies that requires higher version (1.7.0) in this case you must downgrade this packages also in the packages.json.
or
answered Sep 18, 2017 at 10:29
AlexAlex
1,2571 gold badge15 silver badges12 bronze badges
I am trying to globally install an npm module I just published. Every time I try to install, either from npm or the folder, I get this error.
npm ERR! Error: ENOENT, chmod '/usr/local/lib/node_modules/takeapeek/lib/cmd.js'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR! System Linux 3.8.0-19-generic
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "takeapeek"
npm ERR! cwd /home/giodamlio
npm ERR! node -v v0.10.6
npm ERR! npm -v 1.3.6
npm ERR! path /usr/local/lib/node_modules/takeapeek/lib/cmd.js
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/giodamlio/npm-debug.log
npm ERR! not ok code 0
I am using sudo and I have triple checked everything in the package everything should work. I did some searching around, and saw a couple of similer cases none of which have been resolved. Here is what I tried.
- Upgrade npm (
sudo npm install -g npm) - Clear the global npm cache (
sudo npm cache clear) - Clear the user npm cache (
npm cache clear)
I noticed that the error had to do with the file I am linking to the path, specifically when npm tried to do a chmod. That shouldn’t be a problem, my lib/cli.js has normal permissions, and npm has superuser permissions during this install.
After digging through the npm docs I found an option that would stop npm from making the bin links(--no-bin-links), when I tried the install with it, it worked fine.
So what’s the deal? Is this some weird fringe case bug that has no solution yet?
Edit: For reference, here is the module I uploaded
mikemaccana
103k93 gold badges371 silver badges469 bronze badges
asked Aug 1, 2013 at 9:49
9
Ok it looks like NPM is using your .gitignore as a base for the .npmignore file, and thus ignores /lib. If you add a blank .npmignore file into the root of your application, everything should work.
A better, more explicit approach is to use an allow-list rather than a disallow-list, and use the «files» field in package.json to specify the files in your package.
[edit] — more info on this behaviour here: https://docs.npmjs.com/cli/v7/using-npm/developers#keeping-files-out-of-your-package
answered Aug 2, 2013 at 15:03
badsyntaxbadsyntax
9,2553 gold badges45 silver badges65 bronze badges
10
I ran into a similar problem,
npm cache clean
solved it.
![]()
Uri Agassi
36.5k13 gold badges76 silver badges93 bronze badges
answered May 3, 2014 at 15:06
GenjuroGenjuro
7,2657 gold badges39 silver badges61 bronze badges
2
This problem somehow arose for me on Mac when I was trying to run npm install -g bower. It was giving me a number of errors for not being able to find things like graceful-fs. I’m not sure how I installed npm originally, but it looks like perhaps it came down with node using homebrew. I first ran
brew uninstall node
This removed both node and npm from my path. From there I just reinstalled it
brew install node
When it completed I had node and npm on my path and I was able to run
rm -rf ~/.npm
npm install -g bower
This then installed bower successfully.
Updating the brew formulas and upgrading the installs didn’t seem to work for me, I’m not sure why. The removal of the .npm folder was something that had worked for other people, and I had tried it without success. I did it this time just in case. Note also that neither of the following solved the problem for me, although it did for others:
npm cache clean
sudo npm cache clean
answered Jan 9, 2014 at 23:52
user1978019user1978019
2,8081 gold badge28 silver badges37 bronze badges
0
I encountered similar behavior after upgrading to npm 6.1.0. It seemed to work once, but then I got into a state with this error while trying to install a package that was specified by path on the filesystem:
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
The following things did not fix the problem:
rm -rf node_modulesnpm cache clean(gavenpm ERR! As of npm@5, the npm cache self-heals….use 'npm cache verify' instead.)npm cache verifyrm -rf ~/.npm
How I fixed the problem:
rm package-lock.json
answered Jul 12, 2018 at 12:50
IanIan
10.8k2 gold badges35 silver badges57 bronze badges
I was getting this error on npm install and adding .npmignore did not solve it.
Error: ENOENT, stat ‘C:UsersMy-UserNameAppDataRoamingnpm’
I tried going to the mentioned folder and it did not exist.
The error was fixed when I created npm folder in Roaming folder.
This is on Windows 8.1
answered Nov 15, 2014 at 23:08
I had the same problem, and just found a handling not mentioned here. Though I’d contribute to the community:
npm install -g myapp was not copying the bin directory. I found this to be because I did not include it in the files in my package.json
"files": [
"lib",
"bin" // this was missing
]
answered Jun 11, 2015 at 0:26
![]()
dthreedthree
19.2k14 gold badges75 silver badges105 bronze badges
3
Delete package-lock.json file then run npm install
answered Apr 13, 2021 at 6:00
![]()
ClarkClark
1391 silver badge11 bronze badges
I was getting a similar error on npm install on a local installation:
npm ERR! enoent ENOENT: no such file or directory, stat '[path/to/local/installation]/node_modules/grunt-contrib-jst'
I am not sure what was causing the error, but I had recently installed a couple of new node modules locally, upgraded node with homebrew, and ran ‘npm update -g’.
The only way I was able to resolve the issue was to delete the local node_modules directory entirely and run npm install again:
cd [path/to/local/installation]
npm rm -rdf node_modules
npm install
answered Dec 31, 2015 at 0:40
g.careyg.carey
6807 silver badges6 bronze badges
I have a similar problem specifucally :
ERR! enoent ENOENT: no such file or directory, chmod ‘node_modules/npm/node_modules/request/node_modules/http-signature/node_modules/sshpk/bin/sshpk-conv
I tried all above solutions but no luck.
I was using vagrant box, and the project was in a shared folder. The problems seems to be only there, when I move the project to another not shared folder (woth host), voila! problem solved.
Just in case another person was using also vagrant
answered Mar 2, 2017 at 21:05
1
I got the simple solution, just clear the npm cache.
sudo npm cache clear --force
then remove the node_modules & package-lock.json
sudo rm -rf node_modules
sudo rm -rf package-lock.json
Now install the dependencies module using npm and start the server
npm install && npm start
answered Jul 17, 2021 at 2:38
![]()
I got a similar error message when trying to npm install a bunch of dependencies. Turns out some of them fail to install on Debian/Ubuntu because they expect /usr/bin/node to be the node executable. To fix, you need do
sudo ln -s nodejs /usr/bin/node
or better yet,
sudo apt-get install nodejs-legacy
For more info: https://stackoverflow.com/a/21171188/7581
answered Feb 19, 2015 at 6:26
itsadokitsadok
28.5k29 gold badges124 silver badges170 bronze badges
I got this error while trying to install a grunt plugin. i found i had an outdated version of npm and the error went away after updating npm to the latest version
npm install -g npm
answered Apr 4, 2015 at 16:13
![]()
Prabhu MurthyPrabhu Murthy
8,9615 gold badges28 silver badges36 bronze badges
I think your compiled coffee script is missing from the published npm package. Try writing a prepublish command.
answered Aug 1, 2013 at 23:34
leewayleeway
4751 gold badge3 silver badges8 bronze badges
2
In my case (multiple code ENOENT errno 34) problem was with ~/.npm/ directory access. Inside it there were some subdirs having root:root rights, which were causing problems while I run commands as normal user (without sudo). So I changed ownership of all subdirs and files inside ~/.npm/ dir into my local user and group. That did the trick on my Ubuntu (on Mac should work too).
$ sudo chown yourusername.yourgroupname ~/.npm/ -R
You should know your user name, right? If no then run $ whoami and substitute your group name with it too, like this:
$ sudo chown johnb.johnb ~/.npm/ -R
EDIT:
Test case:
From my local account /home/johnb I npm-installed globally some generator for yeoman, like this:
$ sudo npm install -g generator-laravel
Problem nature:
Above action caused some dependencies being installed inside ~/.npm/ dir, having root:root ownership (because of sudo ...). Evidently npm does not run as local user (or change dependencies subdirs ownership afterwards) when pulling dependencies and writing them to a local user subdir ~/.npm/.
As long as npm would be so careless against fundamental unix filesystem security issues the problem would reoccur.
Solution:
-
Continuosly check if
~/.npm/contains subdirs with ownership (and/or permissions) other than your local user account, especially when you install or update something withsodo(root). If so, change the ownership inside~/.npm/to a local user recursively. -
Ask
npm, bower, grunt, ...community that they address this issue as I described it above.
answered May 28, 2014 at 22:10
Had a similar Issue but I was in wrong directory please cross check the path of thee file & the run npm start
answered May 2, 2022 at 3:01
1
I tried all the stuff I found on the net (npm cache clear and rm -rf ~/.npm), but nothing seems to work. What solved the issue was updating node (and npm) to the latest version. Try that.
answered May 24, 2014 at 16:49
Nikola M.Nikola M.
5736 silver badges16 bronze badges
In Windows I had a similar error.
Search paste App Data and search for the string npm.
I replaced the string 'npm' (including quotes) with 'npm.cmd' in both atlasboardlibpackage-dependency-manager.js and atlasboardlibclicommands.js. That fixed the problem.
Bob Gilmore
11.9k13 gold badges50 silver badges53 bronze badges
answered Oct 27, 2014 at 17:20
The same error during global install (npm install -g mymodule) for package with a non-existing script.
In package.json:
...
"bin": {
"module": "./bin/module"
},
...
But the ./bin/module did not exist, as it was named modulejs.
answered Nov 3, 2014 at 12:40
hg.hg.
3241 silver badge13 bronze badges
0
- Install latest version of node
- Run: npm cache clean
- Run: npm install cordova -g
answered Jan 10, 2017 at 3:29
You can get this error if your node.js is corrupted somehow as well. I fixed this error by uninstall/restart/install node.js completely and it fixed this error, along with the three other mysterious errors that are thrown.
answered May 26, 2018 at 4:04
Be careful with invalid values for keys «directories» and «files» in package.json
If you start with a new application, and you want to start completely blank, you have to
either start in a complete empty folder or have a valid package.json file in it.
If you do not want to create a package.json file first, just type: npm i some_package
Package with name «some_package» should be installed correctly in a new sub folder «node_modules».
If you create a package.json file first, type: npm init
Keep all the defaults (by just clicking ENTER), you should end up with a valid file.
It should look like this:
{
"name": "yourfoldername",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"author": "",
"license": "ISC"
}
Note that the following keys are missing: «directories«, «repository» and «files«. It looks like if you use incorrect values for «directories» and/or «files«, you are not able to install the package. Leaving these keys out, solved the issue for me.
Also note key «main«. This one is present, but it does contain an invalid value. No file «index.js» exists (yet). You can safely remove it.
Now type: npm i some_package
and package with name «some_package» should be installed correctly in a new sub folder «node_modules».
answered Oct 16, 2018 at 13:16
![]()
RWCRWC
4,4292 gold badges20 silver badges26 bronze badges
Had a similar error with npm in a docker container for webpack. The issue was caused by the —user command line argument of docker run, because the given user and group in there somehow messed up the rights on the local volume. Hope this helps someone 🙂
answered Mar 16, 2020 at 21:28
HajoHajo
8596 silver badges21 bronze badges
Tried nearly everything then finally this:
Simply remove node_modules then run 'npm install' again
answered May 3, 2020 at 15:08
![]()
Alex StephensAlex Stephens
2,9071 gold badge35 silver badges41 bronze badges
I had the same problem on ubuntu, and got rid of the problem by closing the terminal and opening a new one.
answered Mar 3, 2021 at 11:50
1
It’s because there is no package.json and only package-lock.json
Try: npm init —yes
answered Jul 3, 2021 at 18:14
RachelRachel
892 silver badges8 bronze badges
I had a similar issue with a different cause: the yo node generator had added "files": ["lib/"] to my package.json and because my cli.js was outside of the lib/ directory, it was getting skipped when publishing to npm.
(Yeoman issue at https://github.com/yeoman/generator-node/issues/63 it should be fixed soon.)
answered Nov 6, 2014 at 16:51
Nathan FriedlyNathan Friedly
7,7693 gold badges39 silver badges59 bronze badges
I was getting the error «Error: ENOENT, stat ‘C:UsersuserNameAppDataRoamingnpm’. But there was no such directory. Created the directory and the npm install started working
answered Jan 29, 2015 at 2:39
I recently upgraded to node 4.2.1 on a Windows 7 x64 machine. When running
npm install -g bower
I got a similar error:
npm ERR! enoent ENOENT: no such file or directory, open ‘C:UsersTHE_USERNAMEAppDataLocalTempnpm-THE_HASH’
Thinking it was related to the AppData path, I played around with
npm config edit
and
npm config edit --global
to change the prefix, cache and tmp fields but received the same error with the new paths:
npm ERR! enoent ENOENT: no such file or directory, open ‘C:UsersTHE_USERNAMEnpm-tempnpm-THE_HASH’
All commands were run as Administrator, so I had full permissions.
Then I thought there were some issues with existing files so I ran:
npm cache clean
But got the same error. However, there were still some temp files lying around. Manually removing all temp data with cygwin finally fixed the problem for me:
rm -rf bower bower.cmd node_modules etc
If you only have Windows cmd, you could use something like
rmdir /S THE_TEMP_DIR
to remove all subdirectories (although if you have deeply nested node dependencies, this is notoriously problematic)
So, maybe there is some issues with upgrading npm and having versions of bower or other packages hanging around. In my case that seemed to be the problem
answered Oct 30, 2015 at 16:45
![]()
While installing ionic I got below error
115648 error enoent ENOENT: no such file or directory, rename
‘C:UsersUserNameAppDataRoamingnpmnode_modules.stagingansi-b11f0c4b’
-> ‘C:UsersUserNameAppDataRoamingnpmnode_modulesionicnode_modulescordova-libnode_modulesansi’
There was no folder called ansi at that path. I created it there and it installed correctly.
answered Jan 6, 2017 at 17:50
![]()
0
If you tried to «make install» in your project directory with this error you can try it:
rm -rf ./node_modules
npm cache clear
npm remove sails
then you can try to «make install»
If you have the «npm ERR! enoent ENOENT: no such file or directory, chmod ‘…/djam-backend/node_modules/js-beautify/js/bin/css-beautify.js'» then you can try to install some previous version of the js-beautify, more comments: https://github.com/beautify-web/js-beautify/issues/1247
"dependencies": {
...
"js-beautify": "1.6.14"
...
}
and the run «make install». It seem works in case if you have not other dependencies that requires higher version (1.7.0) in this case you must downgrade this packages also in the packages.json.
or
answered Sep 18, 2017 at 10:29
AlexAlex
1,2571 gold badge15 silver badges12 bronze badges
Errors
- Сломанная установка npm
- Random errors
- Не найдена совместимая версия
- Permissions errors
Error: ENOENT, stat 'C:Users<user>AppDataRoamingnpm'в Windows 7- No space
- No git
- Запуск блока Vagrant на Windows не удается из-за проблем с длиной пути
- npm использует только
git:иssh+git:URL-адреса для репозиториев GitHub, нарушая прокси - SSL error
- SSL-intercepting proxy
- Не найдено/Ошибка сервера
- Invalid JSON
- Многие ошибки
ENOENT/ENOTEMPTYв выводе cb() never called!при использовании термоусадочных зависимостей- ошибки при входе в npm
npmзависает в Windows наaddRemoteTarball- npm не запускает последнюю версию на машине с Windows
Сломанная установка npm
Если ваш npm сломан:
- На Mac или Linux переустановите npm .
- Windows: если вы используете Windows и у вас не работает установка, проще всего переустановить узел из официального установщика (см. Это примечание об установке последней стабильной версии ).
Random errors
- Некоторые странные проблемы можно решить, просто запустив
npm cache cleanи повторив попытку. - Если у вас возникли проблемы с
npm install, используйте параметр-verbose, чтобы увидеть более подробную информацию.
Не найдена совместимая версия
У вас устаревший npm. Пожалуйста, обновите npm до последней стабильной версии .
Permissions errors
См. Обсуждения в разделах « Загрузка и установка Node.js и npm » и « Устранение ошибок разрешений EACCES при глобальной установке пакетов », чтобы узнать, как избежать и устранить ошибки разрешений.
Error: ENOENT, stat 'C:Users<user>AppDataRoamingnpm' в Windows 7
Ошибка Error: ENOENT, stat 'C:Users<user>AppDataRoamingnpm' в Windows 7 является следствием joyent / node # 8141 и является проблемой установщика Node для Windows. Обходной путь — убедиться, что C:Users<user>AppDataRoamingnpm существует и доступен для записи с вашей обычной учетной записью.
No space
npm ERR! Error: ENOSPC, write
Вы пытаетесь установить диск,на котором либо нет места,либо нет разрешения на запись.
- Освободите место на диске или
- Установите папку tmp где-нибудь с большим пространством:
npm config set tmp /path/to/big/drive/tmpили - Соберите Node самостоятельно и установите его где-нибудь,где есть место для записи с большим количеством места.
No git
npm ERR! not found: git ENOGIT
Вам необходимо установить git . Или вам может потребоваться добавить информацию о git в свой профиль npm. Вы можете сделать это из командной строки или на веб-сайте. Для получения дополнительной информации см. « Управление настройками вашего профиля ».
Запуск блока Vagrant на Windows не удается из-за проблем с длиной пути
@drmyersii прошел через много мучительных проб и ошибок, чтобы предложить рабочее решение, включающее длинные пути Windows и некоторую настраиваемую конфигурацию Vagrant:
Это коммит, в котором я его реализовал , но я опубликую здесь основной фрагмент кода:
config.vm.provider "virtualbox" do |v| v.customize ["sharedfolder", "add", :id, "--name", "www", "--hostpath", (("//?/" + File.dirname(__FILE__) + "/www").gsub("/","\"))] end config.vm.provision :shell, inline: "mkdir /home/vagrant/www" config.vm.provision :shell, inline: "mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` > www /home/vagrant/www", run: "always"В приведенном выше коде я добавляю
\?К абсолютному пути текущего каталога. Это фактически заставит Windows API разрешить увеличение переменной MAX_PATH (обычно не более 260). Подробнее о максимальном пути . Это происходит во время создания общей папки, которая намеренно обрабатывается VBoxManage, а не методом Vagrant «synced_folder». Последний пункт довольно понятен; мы создаем новую общую папку, а затем убеждаемся, что она монтируется каждый раз, когда к машине обращаются или касаются, поскольку Vagrant любит перезагружать свои монтированные / общие папки при каждой загрузке.
npm использует только git: и ssh+git: URL-адреса для репозиториев GitHub, нарушая прокси
@LaurentGoderre исправил это с помощью некоторых уловок Git :
Я исправил эту проблему для нескольких своих коллег,запустив следующие две команды:
git config --global url."https://github.com/".insteadOf git@github.com: git config --global url."https://".insteadOf git:Одна вещь, которую мы заметили, заключается в том, что используемый
.gitconfigне всегда является ожидаемым, поэтому, если вы находитесь на машине, которая изменила домашний путь к общему диску, вам необходимо убедиться, что ваш.gitconfigодинаков как на вашем общем диске, так и на вc:users[your user]
SSL Error
npm ERR! Error: 7684:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:opensslssls23_clnt.c:787:
Вы пытаетесь подключить SSL к незашифрованной конечной точке. Чаще всего это связано с ошибкой конфигурации прокси (см. также это полезное, хотя и устаревшее, руководство ). В этом случае вам не нужно отключать strict-ssl — вам может понадобиться настроить файл CA/CA для использования с вашим прокси, но гораздо лучше потратить время на то, чтобы разобраться в этом, чем отключать защиту SSL.
npm ERR! Error: SSL Error: CERT_UNTRUSTED
npm ERR! Error: SSL Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE
Эта проблема может возникнуть, если вы используете Node 0.6. Пожалуйста, обновите до версии 0.8 или выше. Подробности смотрите в этом посте .
Вы также можете попробовать следующие обходные пути: npm config set ca "" или npm config set strict-ssl false
npm ERR! Error: SSL Error: SELF_SIGNED_CERT_IN_CHAIN
npm больше не поддерживает самоподписанные сертификаты
Either:
- обновите свою версию npm
npm install npm -g --ca="" - указать вашей текущей версии npm использовать известных регистраторов
npm config set ca=""
Если это не решит проблему, возможно, у вас прокси для перехвата SSL. (Например, https://github.com/npm/npm/issues/7439#issuecomment-76024878 )
SSL-intercepting proxy
Неразрешенный. См. Https://github.com/npm/npm/issues/9282
Не найдено/Ошибка сервера
npm http 404 https: npm ERR! fetch failed https: npm ERR! Error: 404 Not Found
npm http 500 https://registry.npmjs.org/phonegap
- Скорее всего, это временный сбой реестра npm. Проверьте статус сервера npm и повторите попытку позже.
- Если ошибка сохраняется,возможно,опубликованный пакет поврежден.Свяжитесь с владельцем пакета и попросите его опубликовать новую версию пакета.
Invalid JSON
npm ERR! SyntaxError: Unexpected token <
npm ERR! registry error parsing json
- Возможный временный сбой реестра npm или поврежденный кеш локального сервера. Запустите
npm cache cleanи / или повторите попытку позже. - Это может быть вызвано корпоративными прокси, которые дают HTML-ответы на запросы
package.json. Проверьте конфигурацию прокси-сервера npm . - Убедитесь, что это не проблема с пакетом, который вы пытаетесь установить (например, недопустимый
package.json).
Многие ошибки ENOENT / ENOTEMPTY в выводе
npm написан для эффективного использования ресурсов при установке, и отчасти это связано с тем, что он пытается делать столько вещей одновременно, сколько это возможно. Иногда это приводит к состояниям гонки и другим проблемам синхронизации. Начиная с npm 2.0.0, было решено очень большое количество этих проблем. Если в выводе журнала вы видите ENOENT lstat , ENOENT chmod , ENOTEMPTY unlink или что-то подобное, попробуйте обновить npm до последней версии. Если проблема не исчезнет, посмотрите npm / npm # 6043 и посмотрите, обсуждал ли кто-нибудь вашу проблему.
cb() never called! при использовании термоусадочных зависимостей
Взгляните на выпуск # 5920 .Мы работаем над исправлением этого, но это довольно сложное состояние гонки, и это отнимает у нас немного времени. Вы можете попробовать переместить файл npm-shrinkwrap.json в сторону, пока мы не исправим это.Это было исправлено в версиях npm новее, чем npm@2.1.5 , поэтому обновите до npm@latest .
npm login ошибки входа в npm
Иногда npm login завершается неудачно без очевидной причины. Первое, что нужно сделать, это войти в систему на https://www.npmjs.com/login и убедиться, что ваш адрес электронной почты на npmjs.com совпадает с адресом электронной почты, который вы указываете для npm login в npm .
Если проблема не в этом или вы видите сообщение "may not mix password_sha and pbkdf2" , то
- Авторизуйтесь на https://npmjs.com/
- Смените пароль на https://npmjs.com/password — вы даже можете «сменить» его на тот же пароль
- Очистите поля, связанные с входом в систему, из
~/.npmrc, например, запустивsed -ie '/registry.npmjs.org/d' ~/.npmrc npm login
и в целом,похоже,это работает.
Историю этой проблемы см. На https://github.com/npm/npm/issues/6641#issuecomment-72984009 .
npm зависает в Windows на addRemoteTarball
Проверьте, установлены ли в вашем .npmrc два временных каталога :
Найдите строки, определяющие переменную конфигурации tmp . Если вы найдете более одного, удалите все, кроме одного.
См. Https://github.com/npm/npm/issues/7590 для получения дополнительной информации об этой необычной проблеме.
npm не запускает последнюю версию на машине с Windows
См. Раздел о Windows здесь .

The npm install command is used for installing JavaScript packages on your local computer.
When developing web projects, you may see issues that cause the npm install command to fail.
You need to see the error message generated in the terminal for clues to resolve the error.
Some of the most common issues for npm install not working are as follows:
- npm command not found
- No
package.jsonfile describing thedependencies - Integrity check failed error
- For Windows: Python not found
Let’s see how you can resolve these errors next.
The npm command not found error
To run the npm install command, you need to have npm installed on your computer
$ npm install
sh: command not found: npm
The error above happens when npm can’t be found under the PATH environment variable.
First, you need to make sure that npm is installed on your computer.
npm is bundled with Node.js server, which you can download from the nodejs.org website.
Once you downloaded and installed Node.js, open the terminal and run the npm -v command.
You should see the version of npm installed on your computer as follows:
Once you see the npm version, you should be able to run the npm install command again.
For more details, visit the fixing npm command not found error article I’ve written previously.
ENOENT: No package.json file
The npm install command looks for a package.json file in order to find the packages it needs to install.
You need to make sure you have a package.json file right in the current directory where you run the command.
You can run the ls -1 command as follows:
$ ls -1
index.js
package-lock.json
package.json
Once you see there’s a package.json file in the output as shown above, then you can run the npm install command.
For this reason, you should always run the npm install command from the root directory of your project.
By the way, npm install will install packages already listed under the dependencies object of your package.json file.
Suppose you have a package.json file as shown below:
{
"name": "n-app",
"version": "1.0.0",
"description": "A Node application",
"dependencies": {
"jest": "^28.1.1",
"typescript": "^4.5.5",
"webpack": "^2.7.0"
}
}
Then npm install will install jest, typescript, and webpack to the generated node_modules/ folder.
If you need to install a new package, then you need to specify the name like these examples:
# 👇 install react package
npm install react
# 👇 install react, react-dom, and axios packages
npm install react react-dom axios
You can install one or many packages with the npm install command.
Integrity check failed error
When you have a package-lock.json file in your project, then npm will check the integrity of the package you downloaded with the one specified in the lock file.
When the checksum of the package is different, then npm will stop the installation and throw the integrity check failed error.
The following is an example of the error:
npm ERR! code EINTEGRITY
npm ERR! Verification failed while extracting @my-package@^1.2.0:
npm ERR! Verification failed while extracting @my-package@^1.2.0:
npm ERR! Integrity check failed:
npm ERR! Wanted: sha512-lQ...HA==
npm ERR! Found: sha512-Mj...vg==
When this happens, you can fix the issue by verifying the cache:
When the command is finished, run npm install again.
If you still see the error, then delete your lock file and clean the npm cache.
Run the following commands from your project’s root directory:
# 👇 remove the lock file
rm package-lock.json
# 👇 remove the node_modules folder
rm -rf node_modules
# 👇 Clear the npm cache
npm cache clean --force
# 👇 run npm install again
npm install
That should fix the issue with the integrity check.
For Windows only: Python not found
When running npm install on Windows, you may see an error that says Can’t find Python executable as shown below:
> node-gyp rebuild
/n-app>node "..node_modulesnode-gypbinnode-gyp.js" rebuild
npm http 304 https://registry.npmjs.org/bcrypt
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python",
you can set the PYTHON env variable.
The node-gyp module is a Node.js tool for compiling native modules written in C and C++. It requires Python to run properly.
Instead of installing Python by yourself, you can install the Windows Build Tools which has Python included.
This is because Windows also requires Visual Studio build tools to make node-gyp run successfully.
If you install only Python, then you may find that you need the build tools later.
Please note that the latest version of Node.js for Windows installer already includes the build tools by default.
But if you can’t update your Node.js version yet, then installing the build tools manually should help you fix this error.
Conclusion
The npm install command may fail to work because of many reasons.
When the command doesn’t work, you need to check the output first and see what specific error you have.
Try a Google search to fix the issue. When you don’t see a solution, try posting a new question at Stack Overflow mentioning the things you have tried to fix the issue.
Good luck resolving the issue! 👍
i am running this all in gitbash console as a administrator.
@tjwebb :i though run ‘npm ERR’ command in windows console as administrator and got below output:
C:Windowssystem32>npm ERR
Usage: npm
where is one of:
add-user, adduser, apihelp, author, bin, bugs, c, cache,
completion, config, ddp, dedupe, deprecate, docs, edit,
explore, faq, find, find-dupes, get, help, help-search,
home, i, info, init, install, isntall, issues, la, link,
list, ll, ln, login, ls, outdated, owner, pack, prefix,
prune, publish, r, rb, rebuild, remove, repo, restart, rm,
root, run-script, s, se, search, set, show, shrinkwrap,
star, stars, start, stop, submodule, t, tag, test, tst, un,
uninstall, unlink, unpublish, unstar, up, update, v,
version, view, whoami
npm -h quick help on
npm -l display full usage info
npm faq commonly asked questions
npm help search for help on
npm help npm involved overview
Specify configs in the ini-formatted file:
C:UsersShivam.npmrc
or on the command line via: npm —key value
Config info can be viewed via: npm help config
npm@1.4.9 C:Program Filesnodejsnode_modulesnpm
Необходимо определиться с версией, которая вам нужна. Я предпочитаю ставить не новейшую версию Node.js, а последнюю LTS.
Установка в Elementary OS, Ubuntu:
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
Установка в Debian:
curl -sL https://deb.nodesource.com/setup_14.x | bash -
apt-get install -y nodejs
Инструкции под разные системы и для разных версий от разработчиков.
Проверка версий:
nodejs -v
npm -v
Если для проекта вы делаете:
npm install
И вылезает ошибка, вроде:
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/.../node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:311:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 5.3.0-42-generic
gyp ERR! command "/usr/bin/node" "/home/.../node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/.../node_modules/node-sass
gyp ERR! node -v v12.16.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.10.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.10.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/d1mon/.npm/_logs/2020-03-31T05_52_52_174Z-debug.log
Необходимо удалить каталог node_modules и файл блокировки package-lock.json, очистить кэш и пробовать заново:
rm -rf node_modules package-lock.json
npm cache clean --force
npm install
Глобальная установка пакетов
Для глобальной установки пакетов в команду добавляется параметр -g. Но это не будет работать по умолчанию из-за проблем с правами доступа, поэтому предварительно требуется сделать следующее.
Создадим каталог для глобальных установок:
mkdir ~/.npm-global
Настройка npm на использование нового каталога:
npm config set prefix '~/.npm-global'
В файл ~/.profile необходимо добавить строку:
export PATH=~/.npm-global/bin:$PATH
В командной строке снова, для применения изменений:
source ~/.profile
На этом все, теперь можно устанавливать пакеты глобально.