Common errors
The error Error: ENOENT, stat 'C:\Users\<user>\AppData\Roaming\npm' on Windows 7 is a consequence of joyent/node#8141, and is an issue with the Node installer for Windows. The workaround is to ensure that C:\Users\<user>\AppData\Roaming\npm exists and is writable with your normal user account.
You are trying to install on a drive that either has no space, or has no permission to write.
- Free some disk space or
- Set the tmp folder somewhere with more space: npm config set tmp /path/to/big/drive/tmp or
- Build Node yourself and install it somewhere writable with lots of space.
You need to install git. Or, you may need to add your git information to your npm profile. You can do this from the command line or the website. For more information, see "Managing your profile settings".
Running a Vagrant box on Windows fails due to path length issues
@drmyersii went through what sounds like a lot of painful trial and error to come up with a working solution involving Windows long paths and some custom Vagrant configuration:
In the code above, I am appending \\?\ to the current directory absolute path. This will actually force the Windows API to allow an increase in the MAX_PATH variable (normally capped at 260). Read more about max path. This is happening during the sharedfolder creation which is intentionally handled by VBoxManage and not Vagrant's "synced_folder" method. The last bit is pretty self-explanatory; we create the new shared folder and then make sure it's mounted each time the machine is accessed or touched since Vagrant likes to reload its mounts/shared folders on each load.
npm only uses git: and ssh+git: URLs for GitHub repos, breaking proxies
I fixed this issue for several of my colleagues by running the following two commands:
One thing we noticed is that the .gitconfig used is not always the one expected so if you are on a machine that modified the home path to a shared drive, you need to ensure that your .gitconfig is the same on both your shared drive and in c:\users\[your user]\
You are trying to talk SSL to an unencrypted endpoint. More often than not, this is due to a proxy configuration error (see also this helpful, if dated, guide). In this case, you do not want to disable strict-ssl – you may need to set up a CA / CA file for use with your proxy, but it's much better to take the time to figure that out than disabling SSL protection.
This problem will happen if you're running Node 0.6. Please upgrade to node 0.8 or above. See this post for details.
You could also try these workarounds: npm config set ca "" or npm config set strict-ssl false
- upgrade your version of npm npm install npm -g —ca=""
- tell your current version of npm to use known registrars npm config set ca=""
If this does not fix the problem, then you may have an SSL-intercepting proxy. (For example, https://github.com/npm/npm/issues/7439#issuecomment-76024878)
Not found / Server error
- It's most likely a temporary npm registry glitch. Check npm server status and try again later.
- If the error persists, perhaps the published package is corrupt. Contact the package owner and have them publish a new version of the package.
- Possible temporary npm registry glitch, or corrupted local server cache. Run npm cache clean and/or try again later.
- This can be caused by corporate proxies that give HTML responses to package.json requests. Check npm's proxy configuration.
- Check that it's not a problem with a package you're trying to install (e.g. invalid package.json ).
Many ENOENT / ENOTEMPTY errors in output
npm is written to use resources efficiently on install, and part of this is that it tries to do as many things concurrently as is practical. Sometimes this results in race conditions and other synchronization issues. As of npm 2.0.0, a very large number of these issues were addressed. If you see ENOENT lstat , ENOENT chmod , ENOTEMPTY unlink , or something similar in your log output, try updating npm to the latest version. If the problem persists, look at npm/npm#6043 and see if somebody has already discussed your issue.
cb() never called! when using shrinkwrapped dependencies
Take a look at issue #5920. We're working on fixing this one, but it's a fairly subtle race condition and it's taking us a little time. You might try moving your npm-shrinkwrap.json file out of the way until we have this fixed. This has been fixed in versions of npm newer than npm@2.1.5 , so update to npm@latest .
npm login errors
Sometimes npm login fails for no obvious reason. The first thing to do is to log in at https://www.npmjs.com/login and check that your e-mail address on npmjs.com matches the email address you are giving to npm login .
If that's not the problem, or if you are seeing the message "may not mix password_sha and pbkdf2" , then
- Log in at https://npmjs.com/
- Change password at https://npmjs.com/password – you can even "change" it to the same password
- Clear login-related fields from
/.npmrc – e.g., by running sed -ie '/registry.npmjs.org/d'
and it generally seems to work.
npm hangs on Windows at addRemoteTarball
Check if you have two temp directories set in your .npmrc :
Look for lines defining the tmp config variable. If you find more than one, remove all but one of them.
How to fix npm install command not working
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.json file describing the dependencies
- 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
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:
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:
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:
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:
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:
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:
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!
Level up your programming skills
I'm sending out an occasional email with the latest programming tutorials. Drop your email in the box below and I'll send new stuff straight into your inbox!
report this ad
About
Sebhastian is a site that makes learning programming easy with its step-by-step, beginner-friendly tutorials.
Learn JavaScript and other programming languages with clear examples.
Search
Type the keyword below and hit enter

report this ad
Click to see all tutorials tagged with:

report this ad
This npm install is not working on Windows
This works great in my Mac. But the same process on Windows and the npm install crashes. This is what I get.
I’ve tried everything I’ve seen on Stack Overflow so far and every link Google search produced. I tried the following as suggested here:
ran it as admin,
tried npm install -g
restarted the XAMPP server
checked the PATH for C:\Program Files\nodejs
Output
node -v gives me version 6.9.1.
npm -v gives me version 4.0.2.
Which proves they are all installed fine. Am I right?
![]()
![]()
8 Answers 8
After countless hours of debugging and researching, I decided to install on a different machine to see if the problem was with my Node.js installation. It worked.
Know that the possibility to uninstall Node.js and delete NPM will be there. This is what I did. I believe it is the safest way to solve the problem and all the rest of your applications installed in your machine will still work.
I credit this answer for these steps, although I had other npm and node_modules in other locations. So do a quick search for these and unless they are part of an application, make sure they are deleted as well.
Uninstall from Programs & Features with the uninstaller.
Reboot (or you probably can get away with killing all Node.js related processes from Task Manager).
Look for these folders and remove them (and their contents) if any still exist. Depending on the version you installed, UAC settings, and CPU architecture, these may or may not exist:
- C:\Program Files (x86)\Nodejs
- C:\Program Files\Nodejs
- C:\Users\
\AppData\Roaming\npm (or %appdata%\npm ) - C:\Users\
\AppData\Roaming\npm-cache (or %appdata%\npm-cache ) - C:\Users\
\.npmrc (and possibly check for that without the . prefix too)
Check your %PATH% environment variable to ensure no references to Node.js or npm exist.
If it’s still not uninstalled, type where node at the command prompt and you’ll see where it resides — delete that (and probably the parent directory) too.
Reboot, for good measure.
![]()
![]()
Please read the error carefully.
The FSEvents API in OS X allows applications to register for notifications of changes to a given directory tree.
It needs OS X, because some of the npm dependencies are using fsevents. That’s why it’s breaking on Windows.
As you were told, it’s working without fsevents. Then you can follow these steps:
Install npm-check-updates and try again.
It will update the dependencies and install the dependencies.
![]()
![]()
Update and then install again:
Add this to fix any errors:
![]()
The only solution that worked for me was deleting npm and npm-cache from C:\Users(your username)\AppData\Roaming.
And uninstalling Node.js and reinstalling it.
![]()
If npm install is not working, then you can use this command:
This works for me.
![]()
Please try to open the console as an administrator.
Do right-click on the command line and select "Open as administrator" and then try installing the dependency.
![]()
![]()
I tried to disabled all my antivirus and firewall, cleared the npm cache, and did cache verify, but nothing worked. The only thing that works on my end is to install the Node Version Manager, nvm .
How does Node Version Manager work?
Permission errors can occur when packages are installed globally. If this is the case, npm may need to be set up to operate without elevated permissions. This where nvm comes in. It lets you install a different Node.js version without triggering the administrative access.
If you have existing Node.js installed, I recommend uninstalling it like the process given by LOTUSMS above:
Uninstall from Programs & Features with the uninstaller.
Reboot (or you probably can get away with killing all node-related processes from Task Manager).
Look for these folders and remove them (and their contents) if any still exist. Depending on the version you installed, UAC settings, and CPU architecture, these may or may not exist:
C:\Program Files (x86)\Nodejs C:\Program Files\Nodejs
C:\Users
\AppData\Roaming\npm (or %appdata%\npm) C:\Users
\AppData\Roaming\npm-cache (or %appdata%\npm-cache) C:\Users
.npmrc (and possibly check for that without the . prefix too) Check your %PATH% environment variable to ensure no references to Nodejs or npm exist. If it’s still not uninstalled, type where node at the command prompt and you’ll see where it resides — delete that (and probably the parent directory) too.
Install nvm here — https://github.com/coreybutler/nvm-windows. or you can use curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
Run nvm or command -v nvm . If something prints, the installation was successful.
Install the prefered node version — e.g. nvm use 16.3.0
Check if the node and npm are properly install. Just run node -v and npm -v
Почему npm install не работает

- Установка с использованием Chocolatey ==> npm не распознается
- Установка с использованием 64-битного установщика nodejs из nodejs.org ==> npm не распознается
- На этом этапе бег where npm дает мне c:\User\<Username>\AppData\Roaming\npm котором нет ничего
- Я выяснил, что nodejs установлен в C:\Program Files\nodejs . Открытие командной строки в этом каталоге делает npm работу нормально.
- Поэтому я добавил C:\Program Files\nodejs к PATH только , чтобы получить ту же ошибку еще раз , что npm is not recognized
- Одна из проблем github в репозитории nodejs говорит о том, что мне нужно перезагрузить компьютер, и он исправит это. Но это не помогло до сих пор
- Я вижу Node.js значок в моем Start -> Programms меню, который выводит меня на консоль nodejs, но не уверен, что с этим делать.
- Откройте панель управления (нажмите кнопку «Пуск», затем нажмите « Панель управления» )
- Нажмите Учетные записи пользователей
- Нажмите Изменить мои переменные среды
- Выберите PATH и нажмите Edit . кнопку
- В конце значения переменной добавьте ;C:\Program Files\nodejs
- Нажмите Ok в окне «Изменить пользовательскую переменную», затем нажмите Ok в окне «Переменные среды».
- Запустите окно командной строки (нажмите кнопку Пуск, затем введите cmd в поиск и нажмите Enter)
- В командной строке ( C:\> ) введите npm и нажмите ввод; теперь вы должны увидеть текст справки ( Usage: npm <command> и т. д.), а не « npm не распознается . »
Для пользователей Windows : картинка говорит тысячу слов 