Like week ago I installed local package globaly by command npm i -g path.
It worked fine since today. I tried to use npm i -g path again and i get this error:
npm ERR! code ENOENT
npm ERR! syscall rename
npm ERR! path "user"\AppData\Roaming\npm\node_modules\.staging\js2cp-28011c0d\node_modules\fs-extra
npm ERR! dest "user"\AppData\Roaming\npm\node_modules\.staging\fs-extra-d19736e5
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, rename '"user"\AppData\Roaming\npm\node_modules\.staging\js2cp-28011c0d\node_modules\fs-extra' -> '"user"\AppData\Roaming\npm\node_modules\.staging\fs-extra-d19736e5'
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! "user"\AppData\Roaming\npm-cache\_logs\2021-07-27T07_39_50_112Z-debug.log
I wanted to go into "user"\AppData\Roaming\npm\node_modules\ but I cant find folder ./.staging inside the node_modules folder.
Any ideas what's causing this error and how to fix it?
you can do couple things to fix this quickly
a. clean cache: npm cache clean --force
b. delete package.lock
if those two doesnt help youl need to be a bit tricky
c. delete node-modules and then npm install againe (hope this will help)
d. delete node with npm and reinstall it
mostly the a and b will solve the problem for ya!
For me, I was accidentally using node 14, while node 16 was the one I was working with before. After switching to node 16 again the problem was resolved. Might be worth a check before reinstalling node.
Related
I recently started working with 'npm' and while installing 'nodemon' using command -
npm i -g nodemon
but it is showing ERR!
npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /usr/local/lib/node_modules/nodemon
npm ERR! dest /usr/local/lib/node_modules/.nodemon-SfftGed4
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/nodemon' -> '/usr/local/lib/node_modules/.nodemon-SfftGed4'
npm ERR! [Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/nodemon' -> '/usr/local/lib/node_modules/.nodemon-SfftGed4'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'rename',
npm ERR! path: '/usr/local/lib/node_modules/nodemon',
npm ERR! dest: '/usr/local/lib/node_modules/.nodemon-SfftGed4'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/rishabhsingh/.npm/_logs/2023-01-28T12_41_30_475Z-debug-0.log
I tried using sudo to install nodemon, clearing cache using npm cache clear even with --force but no help, also tried what terminal was showing me could be the erroe but turned out nothing helpful.
Be careful with this stuff!!
Don't arbitrarily run sudo commands. Some answers online will tell you to run chmod or chown in your /usr directory. This is not a good solution and may potentially break your whole system!
The problem is that npm is trying to install global packages in your /usr folder, but your user doesn't have access to this folder. What you need to do is tell npm to install global packages in a folder which you do have access to.
Create a directory for global npm packages:
mkdir "${HOME}/.npm-packages"
Tell npm where to store globally installed packagesL
npm config set prefix "${HOME}/.npm-packages"
Ensure npm will find the location by adding it to your system's PATH variable. This can be done by editing .bashrc or .zshrc in your home directory and adding the following code to the bottom of the file.
NPM_PACKAGES="${HOME}/.npm-packages"
export PATH="$PATH:$NPM_PACKAGES/bin"
# Preserve MANPATH if you already defined it somewhere in your config.
# Otherwise, fall back to `manpath` so we can inherit from `/etc/manpath`.
export MANPATH="${MANPATH-$(manpath)}:$NPM_PACKAGES/share/man"
Close and re-open your terminal.
I want to start using react , so I first installed node in my windows via command prompt , and then installed react using npx create-react-app ... , and later in vs code terminal when I write npm run start I get the following error, I searched a lot but didnt find a way.
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\LENOVO\Desktop\React/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\LENOVO\Desktop\React\package.json'
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\LENOVO\AppData\Local\npm-cache\_logs\2021-11-27T19_22_54_184Z-debug.log
First move into the Desktop/React/ Folder then do :npm start
After creating react project a new folder named your project is created. You first to go there using cd /folder name. Then do npm start.
You just need to use "npm start" in the terminal.
Lately, I found out that with every package I want to install I keep getting a error. Its always the same.
What I've tried:
Updating node/NPM
Repairing node/NPM
Fixing git bash in path variable.
Deleting package-lock.json and running npm install
Deleting node_modules and package-lock.json and running npm install.
Clearing npm cache
Manually creating the folder it says it can't find. However, this doesn't change anything.
Manually adding the npm package to package-JSON. running npm install but again. results in an error.
Packages installed fine at first. This has been like this for a week or 2.
short error:
npm ERR! code ENOENT
npm ERR! syscall spawn bash
npm ERR! path C:\Users\Timsl\Documents\FarCryDiscordBot\node_modules\better-sqlite3
npm ERR! errno -4058
npm ERR! enoent spawn bash ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
full log:
https://pastebin.com/1B4yLCLK
Why am I getting the following error when I run npm start in react?
C:\Users\ave\geekyShows>npm start
npm ERR! path C:\Users\ave\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\ave\package.json'
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\ave\AppData\Roaming\npm-cache\_logs\2020-01-12T09_04_26_349Z-debug.log
The directory you're currently trying to run doesn't have a package.json file. Maybe you're outside of the project that you just created. Happens to me most of the time when I'm working in hurry. :D
You can just enter inside your project directory that has package.json file like so (Assuming your project name as geekyShows):
cd geekyShows
npm run start
Hope this helps.
So in my recent project I tried to install some node modules, in this case, express and MySQL, which both return the same error:
npm WARN thecaptain.ga#1.0.0 No repository field.
npm ERR! path C:\Users\user\projectroot\node_modules\on-finished
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\user\projectroot\node_modules\on-
finished' -> 'C:\Users\user\projectroot\node_modules.on-finished.DELETE'
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:
I tried to delete all the related files, then reinstalling it, however that did not change anything. I have run npm init before the install even attempted to fill in the dependency manually, to then run npm install. It happens with every node module in any node project I have.
Turns out the issue was because the dropbox tried to synchronize the files as i was installing the package. Pausing or disabling this fixes the issue...
Could you try this please:
1 - Ensure no NPM scripts are running.
2 - Navigate to your project route
3 - Run this command:
rm package-lock.json && npm i
Note - it may also be worth trying to delete your 'node_modules' folder in your project directory and running the above command.