Bootstrap Coder
bootstrap一个美丽的前端框架,努力让他更完美。
npm phantomjs 安装错误Error: EACCES: permission denied

安装 qunarcorp/open_dnsdb 过程中出现问题

在linux服务器中执行npm install 安装依赖时,发生如下错误:

问题:

Download already available at /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Verified checksum of previously downloaded file
Extracting tar contents (via spawned process)
Removing /usr/local/open_dnsdb/dnsdb_fe/node_modules/phantomjs-prebuilt/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1614183154060/phantomjs-2.1.1-linux-x86_64 -> /usr/local/open_dnsdb/dnsdb_fe/node_modules/phantomjs-prebuilt/lib/phantom
Phantom installation failed { [Error: EACCES: permission denied, link '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1614183154060/phantomjs-2.1.1-linux-x86_64' -> '/usr/local/open_dnsdb/dnsdb_fe/node_modules/phantomjs-prebuilt/lib/phantom']
  errno: -13,
  code: 'EACCES',
  syscall: 'link',
  path:
   '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1614183154060/phantomjs-2.1.1-linux-x86_64',
  dest:
   '/usr/local/open_dnsdb/dnsdb_fe/node_modules/phantomjs-prebuilt/lib/phantom' } Error: EACCES: permission denied, link '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1614183154060/phantomjs-2.1.1-linux-x86_64' -> '/usr/local/open_dnsdb/dnsdb_fe/node_modules/phantomjs-prebuilt/lib/phantom'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE

粗略看是权限问题,但我是 root 执行的不存在,肯定是install有bug,终于找到一个帖子,找到了解决方案。

解决:

#下载
wget https://npm.taobao.org/mirrors/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
tar -jxvf phantomjs-2.1.1-linux-x86_64.tar.bz2
#加入环境变量
vim /etc/profile
#末尾加入,注意文件路径
export PATH=$PATH:/usr/local/phantomjs-2.1.1-linux-x86_64/bin
#执行
source /etc/profile

回到项目目录后:

rm -rf ./node_modules && npm install --unsafe-perm

完美解决!!!

<< 上一篇 nginx正向代理-为内网提供外网代理服务 centos 使用 nignx yum源安装nginx 下一篇 >>
文章标签
随意 | Created At 2014 By William Clinton | 蜀ICP备14002619号-4 |