简体   繁体   中英

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.

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 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 .

I also had this problem. Just delete npm folder, it will be created again. This problem is due to user privileges.

对我来说,只需添加--force解决。

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://docs.microsoft.com/en-US/troubleshoot/windows-client/user-profiles-and-logon/renaming-user-account-not-change-profile-path

对我来说, cd ios && pod install && cd ..修复了它。

我遇到了同样的问题,并且能够通过以管理员身份运行 cmd 提示符在 Windows 上解决它。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM