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

npm install failing. Symlink problems? #26

Closed
Sparticuz opened this issue Apr 7, 2016 · 22 comments
Closed

npm install failing. Symlink problems? #26

Sparticuz opened this issue Apr 7, 2016 · 22 comments

Comments

@Sparticuz
Copy link

npm ERR! Linux 3.4.0+
npm ERR! argv "/usr/bin/nodejs" "/usr/local/bin/npm" "install"
npm ERR! node v4.4.2
npm ERR! npm v3.8.5
npm ERR! path ../mime/cli.js
npm ERR! code EPERM
npm ERR! errno -1
npm ERR! syscall symlink

npm ERR! Error: EPERM: operation not permitted, symlink '../mime/cli.js' -> '/mnt/c/users/kyle/Documents/dev/listomaniapi/node_modules/.bin/mime'
npm ERR! at Error (native)
npm ERR! { [Error: EPERM: operation not permitted, symlink '../mime/cli.js' -> '/mnt/c/users/kyle/Documents/dev/listomaniapi/node_modules/.bin/mime']
npm ERR! errno: -1,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'symlink',
npm ERR! path: '../mime/cli.js',
npm ERR! dest: '/mnt/c/users/kyle/Documents/dev/listomaniapi/node_modules/.bin/mime',
npm ERR! parent: 'listomaniapi' }
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! /mnt/c/users/kyle/Documents/dev/listomaniapi/npm-debug.log
npm ERR! code 1
root@localhost:~/dev/listomaniapi#

@cowens
Copy link

cowens commented Apr 7, 2016

How did you try to install npm?

@Sparticuz
Copy link
Author

curl -sL https://deb.nodesource.com/setup_4.x | bash -
apt-get install nodejs

It's what is on nodejs.org's site

@filipeaguiar
Copy link

I've got a similar error when trying to install node and npm using nvm

@ThaJay
Copy link

ThaJay commented Apr 7, 2016

same thing here.
A subdependency would love to make a symlink, and npm i fails because it can't.
We have symlinks in cmd through mklink /J so I don't really get why it's not possible through WSL yet.

npm ERR! Error: EPERM, symlink '../JSONStream/index.js'
npm ERR!  { [Error: EPERM, symlink '../JSONStream/index.js'] errno: 50, code: 'EPERM', path: '../JSONStream/index.js' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 3.4.0+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i"
npm ERR! cwd /mnt/c/dev/scan-app
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path ../JSONStream/index.js
npm ERR! code EPERM
npm ERR! errno 50
npm ERR! stack Error: EPERM, symlink '../JSONStream/index.js'

@therocco
Copy link

therocco commented Apr 7, 2016

Using this I've had some luck installing some npm modules, but it still does have issues with permission errors whenever npm tries to rename a file.

INSTALL GLOBAL NPM PACKAGES
npm config set unsafe-perm true

CLEAN CACHE
npm cache clean

BYPASS SYMLINK ISSUES
npm install --no-bin-links

@Sparticuz
Copy link
Author

We have symlinks in cmd through mklink /J so I don't really get why it's not possible through WSL yet.

What's odd is the ln -s seems to work fine

@sergiogarciadev
Copy link

In my tests, using pip, I was unable to create a virtualenv in my user folder.

root@localhost:/mnt/c/Users/sergi/demoubuntu# virtualenv py27
New python executable in py27/bin/python
Traceback (most recent call last):
  File "/usr/bin/virtualenv", line 3, in <module>
    virtualenv.main()
  File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 825, in main
    symlink=options.symlink)
  File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 985, in create_environment
    site_packages=site_packages, clear=clear, symlink=symlink))
  File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 1405, in install_python
    os.symlink(py_executable_base, full_pth)
OSError: [Errno 1] Operation not permitted

But was able to create inside Ubuntu filesystem

root@localhost:/home# virtualenv py27
New python executable in py27/bin/python
Installing setuptools, pip...done.

@Sparticuz
Copy link
Author

I think you've got the ln -s backwards, mine created just fine inside bash
lrwxrwxrwx 1 root root 31 Apr 7 01:24 dev -> /mnt/c/users/kyle/Documents/dev/

@ThaJay
Copy link

ThaJay commented Apr 8, 2016

I was unable to use ln -s on /mnt/c/ (Operation not permitted) but it did work for me in the unix filesystem, for instance at ~/. a symlink created through mklink /J in cmd showed up in my bash, but it did look a bit strange (same for normal mklink):

$ l
ls: cannot access core: Input/output error
total 8.0K
d????????? ? ?    ?       ?            ? core/
-rwxrwxrwx 1 root root 1.2K Apr  7 15:54 index.js*
drwxrwxrwx 2 root root    0 Mar 31 16:14 subcomponents/
drwxrwxrwx 2 root root    0 Mar 31 16:14 viewcomponents/

thanks nerdofsteel for the suggestions. I too ran into the rename issue when trying to globally install a module. The no symlinks option seems to work like a charm for my local dependencies.

@sergiogarciadev
Copy link

I think the problem for both virtualenv and npm is that those tools tries to create links to the Lxss filesystem.

root@localhost:/mnt/c/Users/sergi# ln -s /root .
ln: failed to create symbolic link ‘./root’: Operation not permitted

@filipeaguiar
Copy link

It appears to be a problem with tar. It doesn't create symlinks ever. Every tool that I've tried to install that uses tar with symlinks fails.

@Sparticuz
Copy link
Author

More info here: microsoft/WSL#3

@allenleeos
Copy link

Just sudo npm install -g npm@5.3.0

@aswathykrishna18
Copy link

$ npm install -g npm
C:\Users\aswathy\AppData\Roaming\npm\npx -> C:\Users\aswathy\AppData\Roaming\npm\node_modules\npm\bin\npx-cli.js
npm ERR! path C:\Users\aswathy\AppData\Roaming\npm\npm
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall open
npm ERR! Error: EPERM: operation not permitted, open 'C:\Users\aswathy\AppData\Roaming\npm\npm'
npm ERR! { Error: EPERM: operation not permitted, open 'C:\Users\aswathy\AppData\Roaming\npm\npm'
npm ERR! cause:
npm ERR! { Error: EPERM: operation not permitted, open 'C:\Users\aswathy\AppData\Roaming\npm\npm'
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'open',
npm ERR! path: 'C:\Users\aswathy\AppData\Roaming\npm\npm' },
npm ERR! stack: 'Error: EPERM: operation not permitted, open 'C:\Users\aswathy\AppData\Roaming\npm\npm'',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'open',
npm ERR! path: 'C:\Users\aswathy\AppData\Roaming\npm\npm' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\aswathy\AppData\Roaming\npm-cache_logs\2018-01-16T10_46_38_513Z-debug.log

@racibaz
Copy link

racibaz commented May 29, 2020

Using this I've had some luck installing some npm modules, but it still does have issues with permission errors whenever npm tries to rename a file.

INSTALL GLOBAL NPM PACKAGES
npm config set unsafe-perm true

CLEAN CACHE
npm cache clean

BYPASS SYMLINK ISSUES
npm install --no-bin-links

Thank. It's working:))

@aqeebimtiaz
Copy link

Using this I've had some luck installing some npm modules, but it still does have issues with permission errors whenever npm tries to rename a file.

INSTALL GLOBAL NPM PACKAGES
npm config set unsafe-perm true

CLEAN CACHE
npm cache clean

BYPASS SYMLINK ISSUES
npm install --no-bin-links

This worked like a charm! Thank you!

@razonklnbd
Copy link

In my case I mount vfat into media so my ubuntu can't create symlinks into that mount point and raise this kind of error.

@ShivanshSharma1
Copy link

Fix the code if the deploy log in Netlify gives any error or warning and it will deploy.

@CodeWithHiteshYT
Copy link

Using this I've had some luck installing some npm modules, but it still does have issues with permission errors whenever npm tries to rename a file.

INSTALL GLOBAL NPM PACKAGES
npm config set unsafe-perm true

CLEAN CACHE
npm cache clean

BYPASS SYMLINK ISSUES
npm install --no-bin-links

Thanks it worked...!!

@Loongphy
Copy link

If you are using vs code, close it!

@killroy42
Copy link

I ran into symlink issues with weird relative paths:
Error: EACCES: permission denied, symlink '../../../lib/node_modules/npm/man/man5/npm-shrinkwrap-json.5' -> '/usr/share/man/man5/npm-shrinkwrap-json.5'

And now npm is borked, as the rollback failed...

@tetris-dev-web
Copy link

tetris-dev-web commented Feb 19, 2022

INSTALL GLOBAL NPM PACKAGES
npm config set unsafe-perm true

CLEAN CACHE
npm cache clean

BYPASS SYMLINK ISSUES
npm install --no-bin-links

It's working... perfect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests