NPM command config is broken - node.js

I edited npm config set <key> <value> and messed up.
Now whenever I try running anything that remotely starts with npm config, I'm getting an issue that looks like that:
Error: Failed parsing JSON config key
How can I reset my npm config or find the file to manually delete my changes?
I have tried reinstalling npm and nvm several times.
Accepted answer
Was technically correct, I also realized that I was missing a second question (ie how to find invisible files athe mac). I'm on a mac and .npmrc is a hidden file (which can be toggled with cmd+shift+.) But all in all, it worked out, thanks yall!

Try editing the config file directly: ~/.npmrc
https://npm.github.io/installation-setup-docs/customizing/the-npmrc-file.html

Related

NPM command (on Windows 10) returns no result

As you saw in the title the command npm does not return anything (as in returning to input again) but is a registered command on Powershell. I have tried removing all nodejs and npm folders and retrying installing it with utilities like nvm, but none of them seem to work. As far as I have checked there is no log output.
Never mind. I found out what was wrong, my CMD was being blocked by a registry key, deleted that and it worked. Thank you!

I got path error : [module not found] whenever I try to run any npm related command in VS Code

Whenever I try to run any npm related command such as npm -v or npm install , it gives me the error:
From the screenshot, you can see that it is trying to navigate to find the module but the module can not be found at:
C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js
Actually, the location of the npm-cli in my system is:
C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js
In fact, I have set the path in the environment variable like this:
User variables:
System variables:
The solution I got is to run this command every time I want to run any npm related command:
SET PATH=C:\Program Files\Nodejs;%PATH%
But it is not a solution to run this command in the terminal every time I start working on my project in VS Code. I want to permanently set the path in the environment variable.
How can I resolve this?
Same issue, this was first major post I saw, so adding my fix for others who find themselves here. Hope it's helpful:
Restart PC, open VS Code, and delete any terminal instances that are still open, as they will not inherit the new path(s) if they are 'session-restored'.
My root cause was updating Node, which for whatever reason prefaced an environmental variable in $PATH$ with a semi-colon ';'. Worked in external cmd.exe, but didn't work in VS Code integrated terminal until I realized I had to restart the old ones.
This thread was the one that eventually got me there:
VS Code terminal doesn't recognize PATH variables

Sublime 3 text - automatically build system when saving a file

How to disable auto-build, when I am trying to save a file in sublime3?
There's no shortcut problem. I checked the Tool-Build and the shortcut for this is CTRL+B. The shortcut for saving files is CTRL+S. But it always automatically builds a system when I want to save any files in sublime.
The message said:
npm install.
I tried to remove npm and node by using sudo rm -rf /usr/local/{bin/{node,npm},lib/node_modules/npm,lib/node,share/man/*/node.*}
. These two are removed because I can't find anything from terminal by checking node -v and npm -v. However, when I try to save file in sublime3 again, it still runs the npm install, even though it said can't find path this time.
I solved it! Click sublime text-preference-package setting- npminstall-setting user-{"install_on_save": false}-save it.
I checked my sublime3, it's not a shortcut problem because shortcut for build is still ctrl+B and the shortcut for save file is ctrl+S.
I removed the npm and node from terminal but when it still shows npm saving when I want to save a file.
So I checked the sublime again and found npminstall package in preference. Now i have to reinstall node and npm.

I really messed up NPM

I think I really screwed up npm. So I tried to get gulp to work and it wasn't so I tried changing the route but by mistake I guess the article I was looking at was for mac and I have windows. Anyways I tried to do a solution and it was still working slightly at the time, so I opened up npm config edit and a file came up to change the prefix but when I did it, I accidentally just copied and pasted instead of putting my actually computer username and now npm wont work at all or even load anything and I am trying to relocate the file but I cant use npm now and I cant find the file.
I was using this to help me out npm - EPERM: operation not permitted on Windows
Found the answer.
You want to go to thisPC -> C: -> users -> \your computers username\ -> npmrc (NPM RC file), go into that file, go to prefix= (kind of at the top) and then fix the path. Thanks everyone!
Just uninstall and reinstall node entirely. It will be faster than attempting to fix this problem.

npm error on every command: EEXIST: file already exists, mkdir 'c:\users\user\appdata\Roaming\npm'

I'm just new to node and npm and this is frustrating.
Well it's almost all said in the title.
On a Windows 10 x64 using a NON elevated prompt, all npm commands shows:
EEXIST: file already exists, mkdir 'c:\Users\Josep\AppData\Roaming\npm'
at Error (native)
Even npm -v shows it twice before the version number.
Not hapening in an elevated prompt. version numbers differ in an elevated and a user prompt.
Double checked PATH variable. Same on two cmd windows.
Node version 6.10.0
NPM Versions: 4.3.0 at elevated prompt and 3.10.10 at a user prompt.
For me, just adding --force solved it.
I had similar issue, solved it by removing .npmrc file, located at c:\Users\<USER>\ location.
I believe it was caused by running earlier npm config set in wrong location.
Kudos to this comments thread.
In my case remove white space from folder name.
Try reinstalling node and npm for the non-admin account. If that's not an option, you can use the portable version:
Download from http://nodejs.org/dist/
Extract the archive.
Open cmd and cd to the extracted folder.
Run nodevars.bat.
It will set PATH and other things so you can now use node from this folder.
I also had this problem. Just delete npm folder, it will be created again. This problem is due to user privileges.
this is because you have same file in node_modules/Cypress/bin and node_modules/.bin, which is cypress(type=file).
Remove cypress(type=file) from node_modules/.bin, this will resolve the issue.
it happened to me, I had a space in my folders path C:\Users\Jhon Doe, should be C:\Users\JhonDoe.
Microsoft has a bit more information about how this can happen: https://learn.microsoft.com/en-US/troubleshoot/windows-client/user-profiles-and-logon/renaming-user-account-not-change-profile-path
For me, cd ios && pod install && cd .. fixed it.
I had the same issue and was able to resolve it on Windows by running the cmd prompt as Admin.
Go to the folder where you have installed Cypress. For example D:\cypressautomation --> then go to "node_modules" --> and then ".bin" folder. Here in this folder, if there is any file named "cypress", then just delete it (before deleting I think cypress needs to be closed). Reopen the cypress. This worked perfectly fine for me.
In my case. edid like below
※one more, check white space from folder name.

Resources