Why am I getting errors with npx?
Asked Answered
T

8

15

everytime when I run any npx command it gives me the same error. Except when I run: npx -v then it gives me the version: 9.2.0

here is the error:

npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path E:\Development
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat 'E:\Development'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Tim\AppData\Local\npm-cache\_logs\2023-01-02T20_03_57_627Z-debug-0.log

I have updated npm with nvm but that didnt make a change.

I want to run npx create-react-app myApp or npx create-electron-app myApp but every command gives me the same error. Can somebody help me to get rid of this error ?

Teishateixeira answered 5/1, 2023 at 12:46 Comment(1)
Seems to be an npm bug github.com/npm/cli/issues/7089Foreandaft
M
40

I had the same problem so I just did this "mkdir %USERPROFILE%\AppData\Roaming\npm" and then everything worked. Seems some sort of setup bug probably because I installed NPM from a different user account on the machine.

Milano answered 8/9, 2023 at 0:17 Comment(3)
For me I still needed to do: 1) npm i npx and 2) npm i npm. Then it worked.Church
calling mkdir %USERPROFILE%\AppData\Roaming\npm as is didn't work for me, so I used the path provided in the error message on my side, i.e. mkdir 'C:\Users\Abdul Rahman\AppData\Roaming\npm' and needed the single quotes as I ran the command on PowerShellHyperopia
☝️ Make sure to run this in a cmd terminal, not in PowerShell: cmd.exe /c "mkdir %USERPROFILE%\AppData\Roaming\npm"Toon
V
9

Also had the same issue.

I was able to resolve it by manually navigating to the mentioned directory and creating the folder that it claimed not to be seen. (in your case "Development" and in my case "npm")

In my case:

C:\Users\<PC-USERNAME>\AppData\Roaming

Started moving from the hard drive (disk C) to the other folder. Ensure you show hidden files. I just created the "npm" folder.

Volkan answered 18/10, 2023 at 13:54 Comment(0)
A
4

That error message means that u don't have npm installed as a global package. So, try installing npm globally again with: npm install -g npm@latest. That should resolved the issue.

Afterdamp answered 21/7, 2024 at 16:29 Comment(0)
M
0
  1. create all directories it's showing doesn't exist manually. sometime packages create folder automatically but if it's not doing so use mkdir to create folder . i had same issue while using npx create-react-app pizza-menu. I was having this error :npx create-react-app pizza-menu npm ERR! code ENOENT npm ERR! syscall lstat npm ERR! path C:\Users\sekho\AppData\Roaming\npm npm ERR! errno -4058 npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\sekho\AppData\Roaming\npm' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent

To solve this I used these steps inside your user folder: cd AppData cd Roaming mkdir npm and it worked.

  1. Make sure install package.json file after deleting it once you create npm folder,sometimes it missed some configuration.
Miscreance answered 29/2, 2024 at 20:0 Comment(0)
L
0

I did npm uninstall -g react-native-cli @react-native-community/cli and init again and it just worked.

Lefty answered 15/3, 2024 at 12:30 Comment(0)
C
0

To anyone else who reaches this from google. Try installing npm globally again with: npm install -g npm@latest. That is what resolved the issue for me.

Caste answered 6/6, 2024 at 14:28 Comment(0)
P
0

The error is because the path does not exist. Just check that the path exists.

In my case I just had to create the "npm" folder and it worked.

Tip: Make hidden items visible.

Pappy answered 29/7, 2024 at 18:26 Comment(0)
H
-1

I think you are facing the issue because your using an capital letter. Try this npx create-react-app my-app

Here answered 5/1, 2023 at 12:53 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.