Hello my problem is when I try to remove any npm package o install my terminal show this warning
npm WARN saveError ENOENT: no such file or directory, open '/Users/liantonypozo/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/Users/liantonypozo/package.json'
some way to fix that without affecting the packages I have installed ?
capture
How are you uninstalling? Do it via npm uninstall packageName. When you have problems, also try deleting node_modules and package-lock.json then doing npm install.
From your screenshot, your list of packages are the global packages, because you ran npm list with the -g flag. You need to do the same with the uninstall command - npm uninstall -g bower - if you want to delete one of those globally installed packages.
Related
I'm using the latest macbook air laptop and trying to install browser-sync globally by this command "sudo npm install -g browser-sync" after install node.js and npm succesfully.
but after I tried this command, my terminal shows this error message again and again when I'm trying to install the package repeatly since I cannot find the browser-sync command.
could anyone help me solve this problem? thank you so much in advance!
I have tried to install this package since yesterday and really don't know how it will work. I checked the user/judy/node_modules folder and can find 3 browser-sync related folders, and tried to delete them but still failed to make the command work.
error message
(base) judy#judydeAir node_modules % sudo npm install -g browser-sync
Password:
npm ERR! code ENOTEMPTY
npm ERR! syscall rename
npm ERR! path /usr/local/lib/node_modules/browser-sync
npm ERR! dest /usr/local/lib/node_modules/.browser-sync-7ZQRhsQ1
npm ERR! errno -66
npm ERR! ENOTEMPTY: directory not empty, rename '/usr/local/lib/node_modules/browser-sync' -> '/usr/local/lib/node_modules/.browser-sync-7ZQRhsQ1'
my path:
(base) judy#judydeAir node_modules % echo $PATH
/Users/judy/opt/anaconda3/bin:/Users/judy/opt/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
failed to use browser-sync command:
(base) judy#judydeAir node_modules % browser-sync --version
zsh: command not found: browser-sync
If I use Command Prompt and run it as admin, I get no problems.
But when I use Git Bash, for whatever reason, when I try to install anything globally, I get this error:
npm ERR! code EPERM
npm ERR! syscall mkdir
npm ERR! path C:\Program Files\nodejs\node_modules\.staging
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\.staging'...
When I'm installing packages locally in specific project folders, a plain npm install, it works perfectly. But I've been trying to run npm install -g bower successfully to no avail.
Sure, I can just run cmd as admin, but I was hoping to get to the bottom of this and understand the problem.
I've tried reinstalling Git Bash, reinstalled Node.js, but still didn't make any progress.
I recently updated my npm version to 2.5.1 and when I installed express locally in my project under node_modules using npm install express --save it came up with this error:
npm WARN locking Error: EACCES, open '/Users/patrick/.npm/_locks/express-44e9a2fe3cb5b729.lock'
npm WARN locking at Error (native)
npm WARN locking /Users/patrick/.npm/_locks/express-44e9a2fe3cb5b729.lock failed { [Error: EACCES, open '/Users/patrick/.npm/_locks/express-44e9a2fe3cb5b729.lock']
npm WARN locking errno: -13,
npm WARN locking code: 'EACCES',
npm WARN locking path: '/Users/patrick/.npm/_locks/express-44e9a2fe3cb5b729.lock' }
npm ERR! Darwin 13.4.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "express" "--save"
npm ERR! node v0.12.0
npm ERR! npm v2.5.1
npm ERR! Attempt to unlock (path to project here)/node_modules/express, which hasn't been locked
When I ran it again with sudo it worked fine, but now my text editor requires me to type in my password every time I overwrite files in the project folder. Why is this happening and how do I fix it?
Note, I not only want to prevent local installs from requiring sudo, but I also want to unlock the project folder so I don't have to keep typing in my password in the text editor.
Doing sudo npm is not recommended by the npm creator Isaac Schlueter:
I strongly encourage you not to do package management with sudo! Packages can run arbitrary scripts, which makes sudoing a package manager command as safe as a chainsaw haircut. Sure, it’s fast and definitely going to cut through any obstacles, but you might actually want that obstacle to stay there.
You shouldn't need it ever with correct permissions and ownership settings:
chown -R $USER <directory>
See here for more details.
Even after, if you run sudo npm again, every created subdirectory will be owned by the superuser and you will be getting errors whenever trying to access them as normal user.
So resist the sudo temptation :)
I went into ~/.npm and ran sudo rm -R ./* to delete the cache, then I modified the permission of the project folder back to my user by running cd (path to project) and sudo chmod -R patrick ./*
I try to run npm install browserify both locally and globally (-g)
but I always got the follow errors
npm ERR! peerinvalid The package bn.js does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer miller-rabin#1.1.2 wants bn.js#^0.16.0
npm ERR! System Darwin 14.0.0
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "browserify"
npm ERR! cwd /Users/kanitw/Dropbox/_Projects/_idl/_visrec/vegalite
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.21
npm ERR! code EPEERINVALID
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/kanitw/Dropbox/_Projects/_idl/_visrec/vegalite/npm-debug.log
npm ERR! not ok code 0
Not sure how to solve it.
(My node version is v0.10.24, I'm on OSX Yosemite)
In order to make the workaround work, you have to
Delete the existing node_modules folder.
npm install miller-rabin#1.1.1 --save-peer
npm install browserify
That works guaranteed.
Had the same issue on Linux. Try running npm update -g
before installing browserify. This has worked for me.
This commit introduced the breaking change: https://github.com/indutny/miller-rabin/commit/bb85f555974587a410a17173f0bc484133b53cb7
The author of the library should fix it, but meanwhile you can:
Delete the existing node_modules folder
npm install miller-rabin#1.1.1 --save-peer
npm install browserify
Recently found this issue on browserify's github.
https://github.com/substack/node-browserify/issues/1049
There is a workaround described.
There are details of a workaround list in the issues on the github page
Error listing
To summarise the solution posted in the issue, you need to install miller-rabin#1.1.1 as a peer-dependency in your own project (npm install miller-rabin#1.1.1 --save-peer) that makes sure the bn.js#0.15 is used rather than the more recent version.
Hope that helps!
Try zipping your existing node_modules and package.json, then delete them.
You may need to 1st generate a new package.json using:
npm init
Then install browserify locally:
npm install browserify
Also, you'll have to install browserify globally:
npm install browserify -g
To zip on CMD or terminal refer to the following article:
How to zip a file using cmd line?
I am currently on npm version 1.2.32. When I run the following:
npm update npm -g
I get the following output:
npm WARN package.json cheerio-select#0.0.3 No repository field.
npm WARN package.json cli-table#0.2.0 No repository field.
npm WARN package.json assert-plus#0.1.2 No repository field.
npm WARN package.json ctype#0.5.2 No repository field.
Then when I check version afterwards using npm -v, it hasn't updated. Is there something else I need to do?
Found the Fancy Windows Install in the docs:
Download zip from http://nodejs.org/dist/npm/
Unpack in the same folder where node.exe lives