Symlink error when installing modules with npm - node.js

I'm trying to install nodemon globally but I'm getting the following error:
npm ERR! Darwin 15.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "nodemon"
npm ERR! node v5.10.1
npm ERR! npm v3.8.3
npm ERR! path ../lib/node_modules/nodemon/bin/nodemon.js
npm ERR! code EPERM
npm ERR! errno -1
npm ERR! syscall symlink
npm ERR! Error: EPERM: operation not permitted, symlink '../lib/node_modules/nodemon/bin/nodemon.js' -> '/usr/local/bin/nodemon'
npm ERR! at Error (native)
npm ERR! { [Error: EPERM: operation not permitted, symlink '../lib/node_modules/nodemon/bin/nodemon.js' -> '/usr/local/bin/nodemon']
npm ERR! errno: -1,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'symlink',
npm ERR! path: '../lib/node_modules/nodemon/bin/nodemon.js',
npm ERR! dest: '/usr/local/bin/nodemon' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/Juanjo/Developer/budget-app/npm-debug.log
I'm new to node (literally the first thing I tried to run after installing it) but I don't think I'm supposed to use sudo to install modules, so perhaps there's something wrong with permissions or something, I just haven't been able to find out what it is. Any help is really appreciated.
This is on OS X 10.11. I already tried both
sudo chown -R `whoami` /usr/local/lib/node_modules
and
sudo chown -R `whoami` /usr/local
But still no luck.

Symlink Issues could really be an issue.
For me, the shortcut was to turn it off by running the installation wihout symlink options like this below:
npm install --no-bin-links

Related

NodeJs shows error while installing module in Linux

I install nodejs with the help of nvm but after installing it and use add a module in workspace it shows error (not showing error in npm init)
I tried npx create-next-app with and without sudo but it isn't working..
So after that i tried making a plain workspace and use npm init it works then i try to install nodemon in it it shows same error. After some time i use no-bin-links and it works...
Kindly help please
npm ERR! code EPERM
npm ERR! syscall symlink
npm ERR! path ../#babel/parser/bin/babel-parser.js
npm ERR! dest /run/media/alokjha/Files/Alok/Websites/my-app/node_modules/.bin/parser
npm ERR! errno -1
npm ERR! Error: EPERM: operation not permitted, symlink '../#babel/parser/bin/babel-parser.js' -> '/run/media/alokjha/Files/Alok/Websites/my-app/node_modules/.bin/parser'
npm ERR! [Error: EPERM: operation not permitted, symlink '../#babel/parser/bin/babel-parser.js' -> '/run/media/alokjha/Files/Alok/Websites/my-app/node_modules/.bin/parser'] {
npm ERR! errno: -1,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'symlink',
npm ERR! path: '../#babel/parser/bin/babel-parser.js',
npm ERR! dest: '/run/media/alokjha/Files/Alok/Websites/my-app/node_modules/.bin/parser'
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! /home/alokjha/.npm/_logs/2021-12-31T16_04_54_357Z-debug-0.log
I use Arch Linux,and bash console..

Nodejs is showing error EPERM, how can i fix it?

PS C:\New folder> npm install -g yo generator-code
npm ERR! code EPERM
npm ERR! syscall mkdir
npm ERR! path C:\Program Files\nodejs\node_modules\generator-code
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\generator-code'
npm ERR! [Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\generator-code'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'C:\\Program Files\\nodejs\\node_modules\\generator-code'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
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! C:\Users\Forever\AppData\Local\npm-cache\_logs\2020-11-25T04_10_40_095Z-debug.log
when I tried to install npm install -g yo generator-code its showing this error . i have run it three times 2 on windows 1 on Linux but everytime its showing this error how can i fix it
Its a permission issue
i would recommned you configure npm to not require sudo/Admin permission to install global packages.
for now just downgrade your npm version or run your cmd with 'Admin privileges'.
if these steps doesn't help
then run this npm cache clean --force and then try reinstalling your package.

npm - EPERM: operation not permitted on Linux

I'm trying to do the react tutorial on my local machine (centOS)
I ran
sudo npm install -g create-react-app
After running that command I got the following error
npm ERR! Linux 3.10.0-514.el7.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "create-react-app"
npm ERR! node v6.10.3
npm ERR! npm v3.10.10
npm ERR! path /tmp/npm-1422-84cdbe70/registry.npmjs.org/tar/-/tar-2.2.1.tgz
npm ERR! code EPERM
npm ERR! errno -1
npm ERR! syscall open
npm ERR! Error: EPERM: operation not permitted, open '/tmp/npm- 1422-84cdbe70/registry.npmjs.org/tar/-/tar-2.2.1.tgz' while getting shasum for /tmp/npm-1422-84cdbe70/registry.npmjs.org/tar/-/tar-2.2.1.tgz
npm ERR! From: https://registry.npmjs.org/tar/-/tar-2.2.1.tgz
npm ERR! at Error (native)
npm ERR! { Error: EPERM: operation not permitted, open '/tmp/npm-1422-84cdbe70/registry.npmjs.org/tar/-/tar-2.2.1.tgz' while getting shasum for /tmp/npm-1422-84cdbe70/registry.npmjs.org/tar/-/tar-2.2.1.tgz
npm ERR! From: https://registry.npmjs.org/tar/-/tar-2.2.1.tgz
npm ERR! at Error (native)
npm ERR! errno: -1,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'open',
npm ERR! path: '/tmp/npm-1422-84cdbe70/registry.npmjs.org/tar/-/tar-2.2.1.tgz',
npm ERR! parent: 'tar-pack' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
I tried going into the directory and untarring the .tgz file and changing around some of the permissions and nothing worked. I followed some solutions online with similar problems but still no luck.
I also ran
npm cache clear
Can anyone explain why this is happening? Any suggestions?
Running npm cache clear or even npm cache clear -fdoes not always clean all the cache.
Sometimes you should remove the cache files manually.
To do so go to the default NPM cache folder and remove its content:
Default: ~/.npm on linux, or %AppData%/npm-cache on Windows.
Then you can attempt to install your desired package with npm install -g.
Please, avoid using sudo npm install -g because you can mess up the npm permissions. Instead change the permission to npm's default directory, or change npm's default directory to another directory. Further details here:
https://docs.npmjs.com/getting-started/fixing-npm-permissions
WARNING: If npm's default path is just /usr, changing the directory permissions will be harmful.
Try to use $: sudo npm install

npm update -g makes my npm gone

I man on Mac OSX and want to perform a npm update to update all globally installed stuff.
After executing npm update -g, I got a lot of erros and npm is gone, like this:
localhost:~ myname$ npm
-bash: npm: command not found
I Googled but don't remember how I installed node. It seems it's not installed via brew, so that I can't use brew to un/reinstall node/npm.
-- UPDATE --
After checking the comments on some other links I decide to just reinstall node and my npm is back. But when I try to use npm install -g npm to update again, the issue returns. Here is the full stuff from my terminal:
localhost:~ myname$ npm install -g npm
npm ERR! Darwin 14.1.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "npm"
npm ERR! node v0.12.1
npm ERR! npm v2.5.1
npm ERR! path /usr/local/lib/node_modules/npm
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES, unlink '/usr/local/lib/node_modules/npm']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/npm' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! error rolling back Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR! error rolling back at Error (native)
npm ERR! error rolling back { [Error: EACCES, unlink '/usr/local/lib/node_modules/npm']
npm ERR! error rolling back errno: -13,
npm ERR! error rolling back code: 'EACCES',
npm ERR! error rolling back path: '/usr/local/lib/node_modules/npm' }
npm ERR! Please include the following file with any support request:
npm ERR! /Users/myname/npm-debug.log
localhost:~ myname$ npm
-bash: /usr/local/bin/npm: No such file or directory
What should I do?
Thanks!
The error says literally: Please try running this command again as root/Administrator. It means you need to update/install with administrator privileges. To do so use "sudo":
sudo npm update -g

npm update error while trying to install ionic

I've got problems trying to install NPM.
Always worked well, but now, i've to install "ionic" and the problem is that when i tried to re-install nodejs all work well, it seems that npm installed but trying to update it, it gives me errors, so i tried to update it via this command:
curl https://www.npmjs.org/install.sh | sh
I cannot install ionic, i don't know why. I've installed months ago cordova and phonegap, but ionic gives me trouble.
Reading guides, tell me to update my npm and doing this, that what i've (this is the following error using the command above)
cleanup prefix=/usr/local
All clean!
unbuild npm#1.4.14
npm ERR! Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR! { [Error: EACCES, unlink '/usr/local/lib/node_modules/npm']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/npm' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 13.2.0
npm ERR! command "/usr/local/bin/node" "/private/var/folders/ry/gd7h2rhs52n10yr83_w50wyw0000gp/T/npm.18934/package/cli.js" "rm" "npm" "-gf"
npm ERR! cwd /private/var/folders/ry/gd7h2rhs52n10yr83_w50wyw0000gp/T/npm.18934/package
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.16
npm ERR! path /usr/local/lib/node_modules/npm
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /private/var/folders/ry/gd7h2rhs52n10yr83_w50wyw0000gp/T/npm.18934/package/npm-debug.log
npm ERR! not ok code 0
> npm#1.4.16 prepublish .
> node bin/npm-cli.js prune --prefix=. --no-global && rm -rf test/*/*/node_modules && make -j32 doc
make: Nothing to be done for `doc'.
npm ERR! error rolling back Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR! error rolling back npm#1.4.16 { [Error: EACCES, unlink '/usr/local/lib/node_modules/npm']
npm ERR! error rolling back errno: 3,
npm ERR! error rolling back code: 'EACCES',
npm ERR! error rolling back path: '/usr/local/lib/node_modules/npm' }
npm ERR! Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR! { [Error: EACCES, unlink '/usr/local/lib/node_modules/npm']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/npm' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 13.2.0
npm ERR! command "/usr/local/bin/node" "/private/var/folders/ry/gd7h2rhs52n10yr83_w50wyw0000gp/T/npm.18934/package/cli.js" "install" "-gf"
npm ERR! cwd /private/var/folders/ry/gd7h2rhs52n10yr83_w50wyw0000gp/T/npm.18934/package
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.16
npm ERR! path /usr/local/lib/node_modules/npm
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /private/var/folders/ry/gd7h2rhs52n10yr83_w50wyw0000gp/T/npm.18934/package/npm-debug.log
npm ERR! not ok code 0
Solved using the command sudo su on my mac os x (so without using sudo with the commando or sudo $username).
then using the curl commando it run.
Thanks however.
Might this answer could be usefull
Try this:
rm -rf /usr/local/lib/node_modules/npm
sudo curl https://www.npmjs.org/install.sh | sh

Resources