Error: EACCES: permission denied, symlink

环境说明

ganiks@ganiks-ubuntu-trusty-64:/ganiks/parse-server$ npm -v
6.5.0
ganiks@ganiks-ubuntu-trusty-64:/ganiks/parse-server$ node -v
v10.15.0

 

问题描述

安装部署 ParseServer服务

ganiks@ganiks-ubuntu-trusty-64:/ganiks/parse-server$ npm install -g mongodb-runner parse-server
[..................] / rollbackFailedOptional: verb npm-session d714a710a2e0bbbc
[..................] / rollbackFailedOptional: verb npm-session d714a710a2e0bbbc
[..................] \ rollbackFailedOptional: verb npm-session d714a710a2e0bbbc
[..................] \ rollbackFailedOptional: verb npm-session d714a710a2e0bbbc
[..................] \ rollbackFailedOptional: verb npm-session d714a710a2e0bbbc
npm WARN deprecated uws@10.148.1: stop using this version
npm ERR! path ../lib/node_modules/mongodb-runner/bin/mongodb-runner.js
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall symlink
npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/mongodb-runner/bin/mongodb-runner.js' -> '/usr/local/bin/mongodb-runner'
npm ERR!  { [Error: EACCES: permission denied, symlink '../lib/node_modules/mongodb-runner/bin/mongodb-runner.js' -> '/usr/local/bin/mongodb-runner']

 

这个错误以前遇到过,关键词 symlink permission,意思是没有创建超链接的权限;

我今天这种环境经常遇到这种问题(Windows宿主机器+Vagrant Ubuntu Host机器)

 

解决方案

给 npm install 添加参数 --no-bin-links

ganiks@ganiks-ubuntu-trusty-64:/ganiks/parse-server$ npm install -g mongodb-runner parse-server --no-bin-links

+ mongodb-runner@4.7.1
+ parse-server@3.1.3
added 563 packages from 403 contributors in 28.79s

ganiks@ganiks-ubuntu-trusty-64:/ganiks/parse-server$ ls /usr/local/lib/node_modules/ -l
total 12
drwxrwxr-x  6 ganiks ganiks 4096 Jan 17 10:23 mongodb-runner
drwxr-xr-x 10 root    root    4096 Jan 17 08:51 npm
drwxrwxr-x  7 ganiks ganiks 4096 Jan 17 10:23 parse-server

 

参考资料

https://stackoverflow.com/questions/39098812/npm-install-when-to-use-no-bin-links

One scenario that I can think of is working with a virtual machine (i.e. vagrant w/ virtual box or VMware) on windows host.
You can't translate symlinks to a synchronized folder on Windows share, so you will need this option to go around it.

Use it for any filesystem that doesn’t support symbolic links.

简言之,所有不支持软链接的磁盘系统都需要用到这个 --no-bin-links

posted @ 2019-01-18 21:02  ganiks  阅读(1997)  评论(0编辑  收藏  举报