What permissions do I need to install Bower on Vagrant on Windows? - windows

I kept running into this error when installing Bower through NPM on a Windows 7 machine running a precise32 Ubuntu Box on Vagrant. I tried every combination of commands and always got the same or very similar errors
Installing locally, globally, with sudo, without sudo, etc.
...
npm ERR! Error: EPERM, open '/home/vagrant/tmp/npm-1214-AHbOCwuM/1391873680685-0.36021817452274263/package/build/node_modules/cheerio/node_modules/htmlparser2/node_modules/readable-stream/test/simple/test-stream2-readable-empty-buffer-no-eof.js'
npm ERR! { [Error: EPERM, open '/home/vagrant/tmp/npm-1214-AHbOCwuM/1391873680685-0.36021817452274263/package/build/node_modules/cheerio/node_modules/htmlparser2/node_modules/readable-stream/test/simple/test-stream2-readable-empty-buffer-no-eof.js']
npm ERR! errno: 50,
npm ERR! code: 'EPERM',
npm ERR! path: '/home/vagrant/tmp/npm-1214-AHbOCwuM/1391873680685-0.36021817452274263/package/build/node_modules/cheerio/node_modules/htmlparser2/node_modules/readable-stream/test/simple/test-stream2-readable-empty-buffer-no-eof.js' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 3.2.0-23-generic-pae
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "bower" "--no-bin-links"
npm ERR! cwd /home/vagrant
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! path /home/vagrant/tmp/npm-1214-AHbOCwuM/1391873680685-0.36021817452274263/package/build/node_modules/cheerio/node_modules/htmlparser2/node_modules/readable-stream/test/simple/test-stream2-readable-empty-buffer-no-eof.js
npm ERR! code EPERM
npm ERR! errno 50
npm ERR! stack Error: EPERM, open '/home/vagrant/tmp/npm-1214-AHbOCwuM/1391873680685-0.36021817452274263/package/build/node_modules/cheerio/node_modules/htmlparser2/node_modules/readable-stream/test/simple/test-stream2-readable-empty-buffer-no-eof.js'
...
EDIT: As well as my answer below please note the file directory + file size limitation when using Windows (260 characters I believe)
I have had to install vagrant in a folder directly on my c:/ drive to get over this limitation as some packages end up having nested dependencies causing this limit to be exceeded. My problem was with grunt-contrib-less

Self answering as I couldn't find a solution anywhere else on StackOverflow
I eventually got it to work via changing to the root user via su root and trying to install globally again. Apparently just using sudo wasn't enough.
So it became
root#precise32: npm install -g bower --no-bin-links
EDIT: As well as this solution please note the file directory + file size limitation when using Windows (260 characters I believe)
I have had to init a vagrant instance in a folder directly on my c:/ drive to get over this limitation as some packages end up having nested dependencies causing this limit to be exceeded. My problem was with grunt-contrib-less
EDIT 2: After coming across this problem again and again I'll add a bit more information for people here regarding node modules and vagrant under Windows.
I now overcome the file path limitation via putting any long dependency chains that fail due to path length (usually EPERM) I add one of the packages in the chain to my own package.json. This means the long requirement chain is split as npm does not re-install the package deeper in the tree if it's already installed.
Just make sure you require a version which is valid for the version string for the module.
The order of the dependencies in package.json does not matter, dependencies are resolved before anything is installed

One of ops guys (vagrant and node.js quick tip) found a solution for that problem. Basically you need to have the following code in your Vagrant file:
config.vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
That will allow npm to create symlinks for the modules that require it.
Than install packages without forcing the symlinks. So, when running npm install on a virtual machine created through vagrant, run it as:
sudo npm install --no-bin-link
It was usefull for me when I installed the express
module.

With Vagrant 1.5 on Windows, you can now use rsync or smb folder shares which won't have this problem.

To get around the 260 character file length limit in windows, which npm seems to surpass quite easily, you can use the npm link command.
This will allow you to use node_modules local to your project. If you run it on your guest machine it will install them globally on your guest machine and then create a symlink in your projects node_modules folder. That way only the symlink is shared to the windows host machine and the 260 file length limit is not exceeded.
I go over this in more detail in this blog post here.

Related

Unable to install npm package due to encoded url

So I recently got a Windows laptop at work, trying to set up my dev environment and I am getting a strange issue when trying to install our private gitlab npm packages.
I try npm install and it says it cannot find the package even though it has been published to our private registry. This seems to only be happening on my windows machine. The package can be found no problem on my macbook.
npm i
npm ERR! code E404
npm ERR! 404 Not Found - GET https://gitlab.orgname.com/api/v4/projects/118/packages/npm/#integrations%2fcommon-ui
npm ERR! 404
npm ERR! 404 '#integrations/common-ui#^1.0.4' is not in this registry.
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jack.lovett\AppData\Local\npm-cache\_logs\2022-12-13T10_08_06_142Z-debug-0.log
It seems that / in the path is being encoded to %2f so then it can't find the package anymore.
I can't find any help online for this issue so any ideas would be greatly appreciated.
The %2f part in the url seemed to not be relevant and just caused me to go down a rabbit hole of unrelated issues.
What seemed to be the problem was that i did not have NVM correctly set to my PATH in my environment variables.
When adding to path I added the location of my /node.js directory in /"Program Files"/node.js. This then added to my path the correct node version used by nvm.
I then attempted to authenticate with our private package registry again and it all worked as expected.

Running Svelte on Windows 10 - 'sirv' is not recognized as a command

I'm trying to get started with Svelte. All guides I've found list two commands as all that's required:
npm install
npm run dev
However, in Windows 10, with a fresh install of Node 12.16.3 LTS and NPM 6.14.4 (installed with NVM-Windows after uninstalling NodeJS completely, per this guide), once I hit npm run dev, I get the following errors:
$ npm run dev
> svelte-app#1.0.0 dev C:\Users\Matthew\Desktop\SvelteTest
> rollup -c -w
'rollup' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! svelte-app#1.0.0 dev: `rollup -c -w`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the svelte-app#1.0.0 dev 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! C:\Users\Matthew\AppData\Roaming\npm-cache\_logs\2020-05-23T02_58_39_101Z-debug.log
"Hmm... Okay, that's weird, since every tutorial I've watched and guide I've read has this including in npm install, but, no worries, I'll just install rollup," I think to myself... A quick npm install -g rollup later, and the error is fixed! Good start. Sadly, this doesn't last too long, since now I run into the following issue:
$ npm run dev
> svelte-app#1.0.0 dev C:\Users\Matthew\Desktop\SvelteTest
> rollup -c -w
rollup v2.10.7
bundles src/main.js → public\build\bundle.js...
LiveReload enabled
created public\build\bundle.js in 338ms
> svelte-app#1.0.0 start C:\Users\Matthew\Desktop\SvelteTest
> sirv public "--dev"
'sirv' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! svelte-app#1.0.0 start: `sirv public "--dev"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the svelte-app#1.0.0 start 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! C:\Users\Matthew\AppData\Roaming\npm-cache\_logs\2020-05-23T03_00_53_008Z-debug.log
This time, no amount of npm install -g sirv will work. Is there a step I'm missing to getting this project to run?
Some notes:
I can get it to work in WSL Ubuntu 18.04 LTS, but would prefer not to have to use WSL if at all possible.
I don't see anything anywhere online that says that Windows isn't supported... is it not? Am I not looking hard enough?
When I run npm install -g rollup, I see the following warnings:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#~2.1.2 (node_modules\rollup\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
I assume that, since this is listed as an optional dependency, it is not the source of the issue. Nonetheless, it feels silly not to bring it up — just in case. These same warnings appear during npm install.
The files npm-cahce\_logs\[datetime]-debug.log don't contain any usefull information as far as I can tell, they simply say, "sirv public "--dev" → Failed to start exec script" followed by a stack-trace.
After the second error, the program does not automatically terminate — but it is not available at localhost:5000.
I had my files in OneDrive for a while (they're now on my Desktop, which is not synced or tracked in any way), and OneDrive was upset about the files in node_modules/.bin, saying that they "couldn't be synced because of their name or type" -- this leads me to believe that perhaps this is a wider Windows/MS problem? Somehow, I doubt this is the issue.
Just to double check, I tried all of my aforementioned steps in Git Bash (my preferred terminal on Windows), CMD, and Powershell -- all exhibited the same behaviour.
Thanks in advance.
Ah, well... I feel silly now. Same issue as with Rollup — I had to install it with npm globally. But, I missed that there's both sirv and sirv-cli on NPM.
Running npm install -g sirv-cli fixed my issue.
However... I would still like to know why I don't see this issue mentioned anywhere in any guide anywhere else with all the rest of Svelte's Hello World stuff. Any information would be greatly appreciated!

Npm Please try using this command again as root/administrator

I've been desperately trying to install modules using node.js but it always fails getting packages with npm.
I logged in as Administrator and used powershell/cmd with "run as administrator". I also had problems with the registry so I used npm set registry http://registry.npmjs.org/
I tried everything... it just drives me nuts.
Here are the errors:
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "generator-knockout"
npm ERR! cwd D:\Sergiu\Knockout Test
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! path D:\Sergiu\Knockout Test\node_modules\generator-knockout\node_modules\yeoman-generator\node_modules\tar\node_modules\block-stream\block-stream.js
npm ERR! fstream_path D:\Sergiu\Knockout Test\node_modules\generator-knockout\node_modules\yeoman-generator\node_modules\tar\node_modules\block-stream\block-stream.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code EPERM
npm ERR! errno 50
npm ERR! stack Error: EPERM, lstat 'D:\Sergiu\Knockout Test\node_modules\generator-knockout\node_modules\yeoman-generator\node_modules\tar\node_modules\block-stream\block-stream.js'
npm ERR! fstream_stack C:\Program Files\nodejs\node_modules\npm\node_modules\fstream\lib\writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: EPERM, lstat 'D:\Sergiu\Knockout Test\node_modules\generator-knockout\node_modules\yeoman-generator\node_modules\tar\node_modules\fstream\LICENSE'
npm ERR! { [Error: EPERM, lstat 'D:\Sergiu\Knockout Test\node_modules\generator-knockout\node_modules\yeoman-generator\node_modules\tar\node_modules\fstream\LICENSE']
npm ERR! errno: 50,
npm ERR! code: 'EPERM',
npm ERR! path: 'D:\\Sergiu\\Knockout Test\\node_modules\\generator-knockout\\node_modules\\yeoman-generator\\node_modules\\tar\\node_modules\\fstream\\LICENSE',
npm ERR! fstream_type: 'File',
npm ERR! fstream_path: 'D:\\Sergiu\\Knockout Test\\node_modules\\generator-knockout\\node_modules\\yeoman-generator\\node_modules\\tar\\node_modules\\fstream\\LICENSE',
npm ERR! fstream_class: 'FileWriter',
npm ERR! fstream_stack:
npm ERR! [ 'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\fstream\\lib\\writer.js:284:26',
npm ERR! 'Object.oncomplete (fs.js:107:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
It turns out that you don’t have to run the command again as Administrator, and doing so won’t fix the problem.
Try:
npm cache clean first.
If that doesn’t fix things, take a look in %APPDATA%\npm-cache, or if you’re using PowerShell, $env:APPDATA\npm-cache.
After cleaning the cache, you may still be left with remnants. Manually remove everything in that directory, and try again. This has always fixed things for me.
As #Crazzymatt was mentioning, as of the npm#5 version and up, we need to use npm cache verify instead of npm cache clean. Or else you will get an error as preceding.
npm ERR! As of npm#5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead.
(Source: MSDN Blog post)
I solve it running as administrator cmd.
Cleaning the cache
npm cache clean -f
And then try to install the package again
You should run cmd.exe as administrator.
Follow the following steps:
Click Start, click All Programs, and then click Accessories.
Right-click Command prompt, and then click Run as administrator.
Here is how I fixed this on my Windows (7) Dev. environment.
I assume the following...
You are Running Command Prompt, Git Bash, Cmder or your favorite Terminal, as an Administrator by right clicking
Privileges Permissions have been granted for Read/Write (i.e chmod -777)
Okay, let's get to it:
Update any packages where a version check is returning a warning ("npm WARN"..) for example...
npm update -g npm
npm update -g graceful-fs
Next we want to force a cache clean. This is flagged by an '--f' or '-f'..
npm cache clean --f
In Widows Explorer search for the following path
%APPDATA%\npm-cache
And Delete it's contents
Start a fresh instance of your Terminal, remembering to 'Right-Click' and 'Run as Administrator', install the packages again.
Hope this helps someone!!
I was already running the Node Command Window as Administrator. As mentioned by many above, the following command with --f (force) solved my issue.
npm cache clean -f
After the Cache Clean, the install was flawless. See the screenshot for reference
I had to login into npm to resolve this issue.
npm login
If you're using TFS or any other source control for your project that sets your checked in files to readonly mode, then you gotta make sure package.json is checked out before running npm install. I've made this mistake plenty of times.
I had the same problem and I've fixed the error by cleaning the cache:
npm cache clean -f
I had the same problem, what I did to solve it was ran the cmd.exe as administrator even though my account was already set as an administrator.
Try following steps
1. Run this command on Terminal or CMD - npm cache clean
2. Go to this folder on windows %APPDATA%\npm-cache And delete folder which you want to install module (Ex:- laravel-elixir) or if you are using PowerShell, $env:APPDATA\npm-cache
3. Then Run your command EX:- npm install laravel-elixir
Here is how I fixed the problem in Windows. I was trying to install the CLI for Angular.
Turn off firewall and antivirus protections.
Right click the nodejs folder (under Program Files), select Properties (scroll all the way down), click the Security tab, and click all items in the ALLOW column (for All System Packages and any user or group that allows you to add the “allow” checkmark).
Click the Windows icon. Type cmd. Right click the top result and select Run as Administrator. A command window results.
Type npm cache clean. If there is an error, close log files or anything open and rerun.
Type npm install -g #angular/cli (Or whatever npm install command you are using)
Check the installation by typing ng –version (Or whatever you need to verify your install)
Good luck!
Note: If you are still having problems, check the Path in Environmental Variables. (To access: Control Panel → System and Security → System → Advanced system settings → Environment variables.) My path variable included the following:
C:\Users\Michele\AppData\Roaming\npm
npm cache verify
Try for newer versions of npm.
I'm using v 5.5.1 and it's working fine.
This is the flow often happens in this case. You run a command with no admin rights, you get message npm ERR! Please try running this command again as root/Administrator.. Then you open one more CLI(cmd, powershell, bash or whatever) and don't close the previous CLI. It appears you have 2 prompts opened in the same directory. And until you close CLI which runs with no admin rights you will be continuously getting npm ERR! Please try running this command again as root/Administrator. So close CLI which runs with no admins rights before running a new one.
NOTE: a lot of IDE has embedded CLI(Visual Studio, VS Code etc) so please close the instance of IDE as well
For those doing this on a MAC. Simply put sudo in front of the command. It will ask you for your password and then run fine. Cheers
What helped me on Windows 10 was just ticking off "Read Only" of project node_modules.
I messed with this problem 2 times and tried all suggestions here with mediocre success.
First time I tried (and succeeded luckily) by:
delete the node_modules folder in your project
npm clean cache -f
check your %APPDATA%/npm-cache and delete everything if not empty
start the terminal as administrator (in my opinion, it isnt a problem of rights, but it wont hurt if you do so)
npm install and then npm update
you will get errors, just install every module that throws an error manually and step by step try to eliminate everything whats wrong
However, this method is quite frustrating and not working everytime. So try this:
Second time I had no luck with the steps above, so I tried to completely reinstall npm and it failed. So I thought there must something be wrong with my node.js installation. My team is running 6.10. and I had the 6.11. and tried it with the 6.10. with no luck.
So I completely wiped everything off my system. Deleted all node modules, checked every path where node or npm could be and cleaned my system.
Then I installed newest 8.1.3
Deleted my project and cloned it to a complete different directory.
Now I installed and updated everything with npm install npm update
Then I compiled with just 2 modules missing and installed them manually
Tadaaaaa, its working now. So all in all it was a problem with node.js. I recommend to everyone who runs into this problem: Try different node versions! And clean ABSOLUTE everything.
As my last resort with this error I created a fresh windows 10 virtual machine and installed the latest nodejs (v6). But there was a host of other "ERRs!" to work through.
I had to run npm cache clean --force which ironically will give you a message that reads "I sure hope you know what you are doing". That seems to have worked.
It doesn't solve the issue on my main Dev machine. I'm canning nodejs as I found over the last few years that you spend more time on fixing it rather than on actual development. I had fewer issues with node on linux ubuntu 14.04 if that's any help.
Deleting the global npm-cache and/or running my cmd line as admin did not work for me. Also, as of npm version 5.x.x, it supposedly recovers from cache corruption by itself.
This did work:
1. Deleted the node_modules folder in my current project.
2. Deleted the package-lock.json in my current project
3. Installed the new package. In my case: npm install bootstrap#next --save
4. Ran npm install for my current project.
Everything now works. In general, nuking node_modules and package-lock.json usually fix these "no apparent reason" bugs for me.
EDIT
I just had the same problem again. But I noticed that everything was installed correctly even though it threw the error after I had followed the steps outlined above. So I could just run ng serve (for Angular), and everything worked.
This sure is a weird error...
As a hack,
Check if the folder path it is complaining exists or not.
If not, try creating them manually and rerun the installation, after clearing the cache
I had success with this, when running the installation from command prompt as an Administrator didn't work
$ npm cache clean
npm ERR! As of npm#5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead.
I tried running npm cache verify with admin rights and it worked after that.
This worked for me, if your package.json is not too big you can do this:
Signout then signin.
Delete node_modules.
npm install again.
Like the other answers, clean npm cache and make sure the cache folder is empty, then run npm install several times. Each time the error message comes for different packages, and the final time (after X attempts) it succeeds.
Run npm clean cache --force
cd %APPDATA%\npm-cache (or cd $env:APPDATA\npm-cache for PowerShell)
del * to delete everything in the folder
Go back into the project folder and run npm install several times until it succeeds. Notice that the error messages come for different packages every time.
WHAT WORKED FOR ME
I ran Command Prompt as Administrator. This helped partially - as I no longer got the error, "Please try using this command again as root/administrator". I was trying to install Cordova. To do it successfully, I also had to do the following:
(1) "npm update node", plus...
(2) I also added the " -g " in the >>npm install cordova<<. In other words, type this: >>npm install -g cordova<<
~~~ FOR WINDOWS 8.1 ~~~
"RUN AS ADMINISTRATOR" COMMAND PROMPT
For windows 8.1, I don't have an ACCESSORIES group when I click START > ALL PROGRAMS. But I do have that older -- but trusty and reliable -- START BUTTON and START MENU - thanks to the free Classic Start Menu app. So, with that installed....
ALTERNATIVE #1:
1. Type "cmd" in the SEARCH BOX at the bottom of the START menu.
2. When cmd.exe shows up in the top of the search results, right click it and select RUN AS ADMINISTRATOR.
ALTERNATIVE #2 If you already have a Command Prompt window open and running - and you want to open another one to Run As Administrator:
1. Locate the Command Prompt app icon in the Taskbar (usually along the bottom of you screen unless you have moved it a different dock/location).
2. Right click the app icon.
3. Now, right click "COMMAND PROMPT" and select RUN AS ADMINISTRATOR.
Hope this helps someone.
I don't know which steps worked for me. But these are my steps to get rid of this error:
Updated Node.js
Ran npm cache clean command in Command prompt ( With
some element of doubt for cache presence)
Ran react-native init in
command prompt as Administrator (on Windows OS), hoping works well
with sudo react-native init on Mac OS
Close the IDE
Close the node terminals running ng serve or npm start
Go to your project folder/node_modules and see you if can find the package that you are trying to install
If you find the package you are searching then delete package folder
In case, this is your 1st npm install then skip step 4 and delete everything inside the node_modules. If you don't find node_modules then create one folder in your project.
Open the terminal in admin mode and do npm install.
That should fix the issue hopefully
FINALLY Got this working after 4 hours of installing, uninstalling, updating, blah blah.
The only thing that did it was to use an older version of node v8.9.1 x64
This was a PC windows 10.
Hope this helps someone.
If you're in react native project, and Expo is running, then close it.
Re-install the package, and everything should be fine.
Also remember to end all other npm commands e.g. npm run dev-server.
A solution that worked, is to close all PowerShell and cmd instances. Start PowerShell/cmd again as administrator and things seem to work.
This can happen if you're doing react-native and the node.js cmd is open in the background.
On windows 10,
npm cache clean --force and npm cache verify did not work for me.
Tried to delete cache folder and file with administrator permission, did not work.
The process-explorer tool helped me finding that Node.exe is holding on the cache file. I killed the process and tried to clean, worked.

nodejs npm global config missing on windows

I can't find at all where npm has its global settings stored.
npm config get userconfig
C:\Users\Jack\.npmrc
npm config get globalconfig
C:\Users\Jack\AppData\Roaming\npm\etc\npmrc
There's no files at either of these paths and yet
npm config get proxy
-> returns my proxy url for work. which I want to delete.
npm config -g delete proxy
npm ERR! Error: ENOENT, unlink 'C:\Users\Jack\AppData\Roaming\npm\etc\npmrc'
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "config" "-g" "delete" "proxy"
npm ERR! cwd C:\f\Dropbox\apps
npm ERR! node -v v0.8.22
npm ERR! npm -v 1.2.14
npm ERR! path C:\Users\Jack\AppData\Roaming\npm\etc\npmrc
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\f\Dropbox\apps\npm-debug.log
npm ERR! not ok code 0
There is a problem with upgrading npm under Windows. The inital install done as part of the nodejs install using an msi package will create an npmrc file:
C:\Program Files\nodejs\node_modules\npm\npmrc
when you update npm using:
npm install -g npm#latest
it will install the new version in:
C:\Users\Jack\AppData\Roaming\npm
assuming that your name is Jack, which is %APPDATA%\npm.
The new install does not include an npmrc file and without it the global root directory will be based on where node was run from, hence it is C:\Program Files\nodejs\node_modules
You can check this by running:
npm root -g
This will not work as npm does not have permission to write into the "Program Files" directory. You need to copy the npmrc file from the original install into the new install. By default the file only has the line below:
prefix=${APPDATA}\npm
For me (being on Windows 10) the npmrc file was located in:
%USERPROFILE%\.npmrc
Tested with:
npm v4.2.0
Node.js v7.8.0
It looks like the files npm uses to edit its config files are not created on a clean install, as npm has a default option for each one. This is why you can still get options with npm config get <option>: having those files only overrides the defaults, it doesn't create the options from scratch.
I had never touched my npm config stuff before today, even though I had had it for months now. None of the files were there yet, such as ~/.npmrc (on a Windows 8.1 machine with Git Bash), yet I could run npm config get <something> and, if it was a correct npm option, it returned a value. When I ran npm config set <option> <value>, the file ~/.npmrc seemed to be created automatically, with the option & its value as the only non-commented-out line.
As for deleting options, it looks like this just sets the value back to the default value, or does nothing if that option was never set or was unset & never reset. Additionally, if that option is the only explicitly set option, it looks like ~/.npmrc is deleted, too, and recreated if you set anything else later.
In your case (assuming it is still the same over a year later), it looks like you never set the proxy option in npm. Therefore, as npm's config help page says, it is set to whatever your http_proxy (case-insensitive) environment variable is. This means there is nothing to delete, unless you want to "delete" your HTTP proxy, although you could set the option or environment variable to something else and hope neither breaks your set-up somehow.
How to figure it out
Start with npm root -- it will show you the root folder for NPM packages for the current user.
Add -g and you get a global folder. Don't forget to substract node_modules.
Use npm config / npm config -g and check that it'd create you a new .npmrc / npmrc file for you.
Tested on Windows 10 Pro, NPM v.6.4.1:
Global NPM config
C:\Users\%username%\AppData\Roaming\npm\etc\npmrc
Per-user NPM config
C:\Users\%username%\.npmrc
Built-in NPM config
C:\Program Files\nodejs\node_modules\npm\npmrc
References:
https://docs.npmjs.com/files/npmrc
https://docs.npmjs.com/misc/config
https://docs.npmjs.com/cli/root.html
Have you tried running npm config list? And, if you want to see the defaults, run npm config ls -l.
Even though we have the .NPMRC can be in 3 locations,
Please NOTE THAT - the file under the Per-User NPM config location take precedence over the Global & Built-in configurations.
Global NPM config => C:\Users\%username%\AppData\Roaming\npm\etc\npmrc
Per-user NPM config => C:\Users\%username%.npmrc
Built-in NPM config => C:\Program Files\nodejs\node_modules\npm\npmrc
To find out which file is getting updated, try setting the proxy using the following command
npm config set https-proxy https://username:password#proxy.company.com:6050
After that open the .npmrc files to see which file get updated.
Isn't this the path you are looking for?
C:\Program Files\nodejs\node_modules\npm\npmrc
I know that npm outputs that , but the global folder is the folder where node.js is installed and all the modules are.
On windows, used the below command that listed down all the default values for npm including the location of config file with variable name userconfig
npm config ls -l

NPM Install fails inconsitently

I'm trying to install some modules using NPM on Cygwin (Windows 7), but the install is going incredibly inconsistently. Some packages fail repeatedly on install, but some succeed; moreover, the same package can fail several times and then succeed with no change in the system. Installing the markdown package failed three times in a row, and then succeeded. The failures were:
npm ERR! couldn't unpack /tmp/npm-1310104605595/1310104605596-0.844648783095181/
tmp.tgz to /tmp/npm-1310104605595/1310104605596-0.844648783095181/contents
npm ERR! Error: EACCES, Permission denied '/tmp/npm-1310104605595/1310104605596-
0.844648783095181/contents/___package.npm/package'
npm ERR!
npm ERR! Please use 'sudo' or log in as root to run this command.
npm ERR!
npm ERR! sudo npm "install" "markdown"
npm ERR!
npm ERR! or set the 'unsafe-perm' config var to true.
npm ERR!
npm ERR! npm config set unsafe-perm true
npm ERR!
npm ERR! System CYGWIN_NT-6.1-WOW64 1.7.9(0.237/5/3)
npm ERR! command "node" "/usr/local/bin/npm" "install" "markdown"
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/Paul/node_modules/express/node_modules/connect/npm-debug.log
npm not ok
Has anyone experienced this, and if so, what was the solution? And yes, I've set the unsafe-perm config variable, and it doesn't seem to change anything... Also, this is not limited to just this package; pretty much anything I try to install seems to have this issue.
P.S: I don't know if you filled an issue at Github yet because Isaacs prefers that to Stackoverflow.com. At github he will receive an email when somebody fills an issue and has excellent respond-times. But after a quick search it seems you allready filled an issue..
Windows Support
I'm trying to install some modules
using NPM on Cygwin (Windows 7), but
the install is going incredibly
inconsistently.
NPM does NOT support Windows. Isaacs does not fix(allocate resources) to any bugs under Windows(Cygwin how does allocate some time to, but not that much) Operating System. He does fix bugs under Cygwin, but you are better of installing a POSIX OS.
Caveat 2: Sorry, Windows!
Any bugs about this not working on a
native Windows system (ie, not Cygwin)
will most likely be closed with
wontfix.
If you ask me you are probably better of(Below I point to the WIKI page to install NPM on Cygwin) installing Ubuntu(Unix) using dual-boot and do your (web)development on Unix. When you get the hang of it you probably will never switch back to Windows again.
Installing under Cygwin
Also there is a page explaining how to install NPM.
Important: Make sure you follow ALL
the steps! It’ll seem like it’s
working before you get to the end. But
it is a dirty, lying liar. Don’t
believe it. Do the steps all the way
to the end. If you don’t, you’re going
to complain that npm says
“ECONNREFUSED” and then post a bug,
and I’ll ask if you did all the steps,
and you’ll feel silly.
Did you follow these steps on their WIKI page to install NPM on Windows=> https://github.com/joyent/node/wiki/Building-node.js-on-Cygwin-(Windows)

Resources