Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\userName\AppData\Roaming\npm' #6971

Closed
2 tasks done
qll1994 opened this issue Nov 7, 2023 · 31 comments
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release

Comments

@qll1994
Copy link

qll1994 commented Nov 7, 2023

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

When "npm install" runs on pipeline server, sometimes below error occurs:
npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\userName\AppData\Roaming\npm'

Expected Behavior

npm install succeeds with no error

Steps To Reproduce

  1. Newly installing node 18.17.1 with npm version: 9.6.7 which replaces node 16.17.1 and npm 8.15.0
  2. Run 'npm install'
  3. See error
    npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\userName\AppData\Roaming\npm'

Workaround may be to create a C:\Users\userName\AppData\Roaming\npm folder manually.

Environment

  • npm:9.6.7

  • Node.js:18.17.1

  • OS Name:Windows

  • npm config:

; copy and paste output from `npm config ls` here
@qll1994 qll1994 added Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release labels Nov 7, 2023
@wraithgar
Copy link
Member

Not enough to reproduce here. It looks like your node installation itself might be invalid but there's no way to know from what's here.

@mwisnicki
Copy link

@wraithgar I can reproduce (and we are not alone):

$ npm config list
; "builtin" config from C:\Program Files\nodejs\node_modules\npm\npmrc

prefix = "C:\\Users\\mwisn\\AppData\\Roaming\\npm"

; "user" config from C:\Users\mwisn\.npmrc

cache = "C:\\Users\\mwisn\\AppData\\Local\\npm-cache"

; node bin location = C:\Program Files\nodejs\node.exe
; node version = v20.5.0
; npm local prefix = C:\Users\mwisn
; npm version = 9.8.0
; cwd = C:\Users\mwisn
; HOME = C:\Users\mwisn
; Run `npm config ls -l` to show all defaults.

Repro:

rm -r ~/AppData/Roaming/npm
npx --yes create-react-app@latest . --template typescript

@hamzakindi
Copy link

If you create the folder name 'npm' in C:\Users<username>\AppData\Roaming directory. It solves the issue. My hunch is that somewhere in the script file this folder path is referred. It seems to be an orphaned entry.

@codarbind
Copy link

If you create the folder name 'npm' in C:\Users\AppData\Roaming directory. It solves the issue. My hunch is that somewhere in the script file this folder path is referred. It seems to be an orphaned entry.

this solved it for me

thanks a bunch

@SilentAssassin101
Copy link

If you create the folder name 'npm' in C:\Users\AppData\Roaming directory. It solves the issue. My hunch is that somewhere in the script file this folder path is referred. It seems to be an orphaned entry.

Thank you so much, this fixed mine as well

@SouvickMazumdar
Copy link

If you create the folder name 'npm' in C:\Users\AppData\Roaming directory. It solves the issue. My hunch is that somewhere in the script file this folder path is referred. It seems to be an orphaned entry.

Thanks a lot....It really worked

@mouadbt
Copy link

mouadbt commented Feb 24, 2024

If you create the folder name 'npm' in C:\Users\AppData\Roaming directory. It solves the issue. My hunch is that somewhere in the script file this folder path is referred. It seems to be an orphaned entry.

this method worked for me

@Ifenna-Pascal
Copy link

Still having the same issues, npm already exists in the roaming folder beforehand

@faisalbhuiyan3038
Copy link

If you create the folder name 'npm' in C:\Users\AppData\Roaming directory. It solves the issue. My hunch is that somewhere in the script file this folder path is referred. It seems to be an orphaned entry.

thanks for the solution, this worked for me too

@xxshady
Copy link

xxshady commented Mar 4, 2024

Issue should be reopened, it's 100% reproducible on clean windows 11 right after installation of LTS nodejs

> npm -v
10.2.4
> node -v
v20.11.1

UPD: nvm, it fixed itself after updating npm: npm install -g npm@latest

@Gabmond
Copy link

Gabmond commented Mar 5, 2024

If you create the folder name 'npm' in C:\Users\AppData\Roaming directory. It solves the issue. My hunch is that somewhere in the script file this folder path is referred. It seems to be an orphaned entry.

Whoa, thanks boss. I just created a new 'npm' folder and it worked.

@xxshady
Copy link

xxshady commented Mar 5, 2024

@Gabmond you could just update npm xd #6971 (comment)

@Gabmond
Copy link

Gabmond commented Mar 5, 2024

@Gabmond you could just update npm xd #6971 (comment)

I already sorted it out, but thanks though.

@Michaelmayo13125152
Copy link

If you create the folder name 'npm' in C:\Users\AppData\Roaming directory. It solves the issue. My hunch is that somewhere in the script file this folder path is referred. It seems to be an orphaned entry.

this worked for me too...

@hzhang20902
Copy link

npm install npm -g

Plug the powerstrip into itself = infinite electricity

@Eh-haque
Copy link

Issue should be reopened, it's 100% reproducible on clean windows 11 right after installation of LTS nodejs

> npm -v
10.2.4
> node -v
v20.11.1

UPD: nvm, it fixed itself after updating npm: npm install -g npm@latest

this works for me.

@JessAT18
Copy link

JessAT18 commented May 2, 2024

If you create the folder name 'npm' in C:\Users\AppData\Roaming directory. It solves the issue. My hunch is that somewhere in the script file this folder path is referred. It seems to be an orphaned entry.

Thanks! This solved my problem.

@NickWoodward
Copy link

If you create the folder name 'npm' in C:\Users\AppData\Roaming directory. It solves the issue. My hunch is that somewhere in the script file this folder path is referred. It seems to be an orphaned entry.

^ worked for me, thanks!

@hzhang20902
Copy link

If you create the folder name 'npm' in C:\Users\AppData\Roaming directory. It solves the issue. My hunch is that somewhere in the script file this folder path is referred. It seems to be an orphaned entry.

npm install npm -g

clean global install, the suspected root of the issue is different user priv of original node installer vs current npm locale (ie work laptop has local file system and network file system, a global install in the network file system does not propagate correctly to the local file system0

@ToufiqAmin
Copy link

If you create the folder name 'npm' in C:\Users\AppData\Roaming directory. It solves the issue. My hunch is that somewhere in the script file this folder path is referred. It seems to be an orphaned entry.

Thanks a lot! This solved my problem.

@Parkavan2003
Copy link

If you create the folder name 'npm' in C:\Users\AppData\Roaming directory. It solves the issue. My hunch is that somewhere in the script file this folder path is referred. It seems to be an orphaned entry.

Thank you so much. It solved my issue 🌟

@jericbas
Copy link

UPD: nvm, it fixed itself after updating npm: npm install -g npm@latest

this is working

@ffonsecalucas
Copy link

If you create the folder name 'npm' in C:\Users\AppData\Roaming directory. It solves the issue. My hunch is that somewhere in the script file this folder path is referred. It seems to be an orphaned entry.

Thank you very much!!! It was the only thing that worked for me.

@faizullahkhan8
Copy link

If you create the folder name 'npm' in C:\Users\AppData\Roaming directory. It solves the issue. My hunch is that somewhere in the script file this folder path is referred. It seems to be an orphaned entry.

its also worked for me thanks bro

@sevilledev
Copy link

If you create the folder name 'npm' in C:\Users\AppData\Roaming directory. It solves the issue. My hunch is that somewhere in the script file this folder path is referred. It seems to be an orphaned entry.

Thanks a lot it worked for me also

@amorcayReal
Copy link

If you create the folder name 'npm' in C:\Users\AppData\Roaming directory. It solves the issue. My hunch is that somewhere in the script file this folder path is referred. It seems to be an orphaned entry.

Thanks mate it still works

@Iswaryasathish
Copy link

If you create the folder name 'npm' in C:\Users\AppData\Roaming directory. It solves the issue. My hunch is that somewhere in the script file this folder path is referred. It seems to be an orphaned entry.

It's worked thankyou

@Html5intheway4
Copy link

If you create the folder name 'npm' in C:\Users\AppData\Roaming directory. It solves the issue. My hunch is that somewhere in the script file this folder path is referred. It seems to be an orphaned entry.

Thank you, this method worked for me.🥳🎉

@VelikiiD
Copy link

VelikiiD commented Oct 2, 2024

If you create the folder name 'npm' in C:\Users\AppData\Roaming directory. It solves the issue. My hunch is that somewhere in the script file this folder path is referred. It seems to be an orphaned entry.

thank you, sir

@TinkerWorX
Copy link

This is still an issue, installed Prebuilt installer v20.18.0 (LTS) for Windows running x64. After creating the npm folder as suggested above, things worked as expected. Maybe the issue should be reopened @wraithgar?

@sandy0903
Copy link

Issue should be reopened, it's 100% reproducible on clean windows 11 right after installation of LTS nodejs

> npm -v
10.2.4
> node -v
v20.11.1

UPD: nvm, it fixed itself after updating npm: npm install -g npm@latest

it worked for me thanks alot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release
Projects
None yet
Development

No branches or pull requests