使用 NPM / NodeJS 安装 PhantomJS 时出错
Error installing PhantomJS with NPM / NodeJS
我最近无法在我的 Vagrant Box 中安装 PhantomJS。 "npm install phantomjs" 失败。
在“/tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2-extract-...安装失败后查看解压文件夹时,文件夹为空.结果是:
[exec] Copying extracted folder /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2-extract-1424249772389/phantomjs-1.9.8-linux-x86_64 -> /vagrant/project/node_modules/phantomjs/lib/phantom
[exec] Phantom installation failed { [Error: ENOTDIR, not a directory '/vagrant/project/node_modules/phantomjs/lib/phantom/bin/phantomjs']
看来安装脚本在提取源代码时遇到了一些问题(可能)。有没有人 运行 遇到同样的问题并解决了它?我需要用 "npm install" 安装 PhantomJS - 所以手动下载不是一个选项。谢谢!
"full npm install" 输出:
[exec] > phantomjs@1.9.15 install /vagrant/project/node_modules/phantomjs
[exec] > node install.js
[exec]
[exec] Downloading https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2
[exec] Saving to /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2
[exec] Using proxy http://127.0.0.1:8080/
[exec] Receiving...
[exec]
[exec] Received 12854K total.
[exec] Extracting tar contents (via spawned process)
[exec] Removing /vagrant/project/node_modules/phantomjs/lib/phantom
[exec] Copying extracted folder /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2-extract-1424249772389/phantomjs-1.9.8-linux-x86_64 -> /vagrant/project/node_modules/phantomjs/lib/phantom
[exec] Phantom installation failed { [Error: ENOTDIR, not a directory '/vagrant/project/node_modules/phantomjs/lib/phantom/bin/phantomjs']
[exec] errno: 27,
[exec] code: 'ENOTDIR',
[exec] path: '/vagrant/project/node_modules/phantomjs/lib/phantom/bin/phantomjs',
[exec] syscall: 'chmod' } Error: ENOTDIR, not a directory '/vagrant/project/node_modules/phantomjs/lib/phantom/bin/phantomjs'
[exec] at Object.fs.chmodSync (evalmachine.<anonymous>:833:18)
[exec] at Object.chmodSync (/vagrant/project/node_modules/phantomjs/node_modules/fs-extra/node_modules/graceful-fs/polyfills.js:141:17)
[exec] at Promise.validExit [as _successFn] (/vagrant/project/node_modules/phantomjs/install.js:145:8)
[exec] at Promise._call (/vagrant/project/node_modules/phantomjs/node_modules/kew/kew.js:373:13)
[exec] at Promise._withInput (/vagrant/project/node_modules/phantomjs/node_modules/kew/kew.js:333:25)
[exec] at Promise.resolve (/vagrant/project/node_modules/phantomjs/node_modules/kew/kew.js:105:27)
[exec] at resolver (/vagrant/project/node_modules/phantomjs/node_modules/kew/kew.js:409:17)
[exec] at CB (/vagrant/project/node_modules/phantomjs/node_modules/fs-extra/node_modules/rimraf/rimraf.js:68:5)
[exec] at Object.oncomplete (fs.js:108:15)
[exec] npm ERR! Linux 3.10.0-123.el7.x86_64
[exec] npm ERR! argv "node" "/usr/bin/npm" "install"
[exec] npm ERR! node v0.10.36
[exec] npm ERR! npm v2.1.5
[exec] npm ERR! code ELIFECYCLE
[exec]
[exec] npm ERR! phantomjs@1.9.15 install: `node install.js`
[exec] npm ERR! Exit status 1
[exec] npm ERR!
[exec] npm ERR! Failed at the phantomjs@1.9.15 install script.
[exec] npm ERR! This is most likely a problem with the phantomjs package,
[exec] npm ERR! not with npm itself.
[exec] npm ERR! Tell the author that this fails on your system:
[exec] npm ERR! node install.js
[exec] npm ERR! You can get their info via:
[exec] npm ERR! npm owner ls phantomjs
[exec] npm ERR! There is likely additional logging output above.
[exec] Writing location.js file
[exec] npm ERR! Linux 3.10.0-123.el7.x86_64
[exec] npm ERR! argv "node" "/usr/bin/npm" "install"
[exec] npm ERR! node v0.10.36
[exec] npm ERR! npm v2.1.5
[exec] npm ERR! path npm-debug.log.a2a87417fd31c590abbf00d595ab39a5
[exec] npm ERR! code ETXTBSY
[exec] npm ERR! errno 62
[exec]
[exec] npm ERR! ETXTBSY, rename 'npm-debug.log.a2a87417fd31c590abbf00d595ab39a5'
[exec] npm ERR!
[exec] npm ERR! If you need help, you may report this error at:
[exec] npm ERR! <http://github.com/npm/npm/issues>
[exec]
[exec] npm ERR! Please include the following file with any support request:
[exec] npm ERR! /vagrant/project/npm-debug.log
好的,我的 "solution" 是我现在在“1.9.10”版本中包含了 PhantomJS,它会在后台从 bitbucket 下载先前的版本,并且不会导致所描述的错误。所以对我来说,NPM 的 PhantomJS 安装脚本的当前版本似乎有问题。
我想在 windows 系统上添加一个解决方案。我希望人们可以找到问题之间的相似之处,并且有些人可能会寻求 windows 的解决方案。
我在 npm install phantomjs 也失败了。我的问题是当我通过 npm 或 yarn 安装时,我无法将 phantomjs-2.1.1-windows.zip 文件下载到临时文件中。错误日志中有一堆can't do command node ./install
这样的杂音,对解决问题没有帮助。
我的解决方案是自己下载 zip 文件,直接进入 \AppData\Local\Temp\phantomjs
并将 zip 文件放在那里,接下来通过 yarn 安装就可以了。
我知道这是一个较旧的问题,但我使用此命令在上次发布的 this wrapper of version 2, specifically for 2.1.1. So I tried to use another mirror, exposed in the official documentation 版本中遇到了同样的问题,并且有效:
npm install --global phantomjs --phantomjs_cdnurl=http://cnpmjs.org/downloads
顺便说一下,PhantomJS is deprecated 还有所有包装纸。
我最近无法在我的 Vagrant Box 中安装 PhantomJS。 "npm install phantomjs" 失败。
在“/tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2-extract-...安装失败后查看解压文件夹时,文件夹为空.结果是:
[exec] Copying extracted folder /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2-extract-1424249772389/phantomjs-1.9.8-linux-x86_64 -> /vagrant/project/node_modules/phantomjs/lib/phantom
[exec] Phantom installation failed { [Error: ENOTDIR, not a directory '/vagrant/project/node_modules/phantomjs/lib/phantom/bin/phantomjs']
看来安装脚本在提取源代码时遇到了一些问题(可能)。有没有人 运行 遇到同样的问题并解决了它?我需要用 "npm install" 安装 PhantomJS - 所以手动下载不是一个选项。谢谢!
"full npm install" 输出:
[exec] > phantomjs@1.9.15 install /vagrant/project/node_modules/phantomjs
[exec] > node install.js
[exec]
[exec] Downloading https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2
[exec] Saving to /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2
[exec] Using proxy http://127.0.0.1:8080/
[exec] Receiving...
[exec]
[exec] Received 12854K total.
[exec] Extracting tar contents (via spawned process)
[exec] Removing /vagrant/project/node_modules/phantomjs/lib/phantom
[exec] Copying extracted folder /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2-extract-1424249772389/phantomjs-1.9.8-linux-x86_64 -> /vagrant/project/node_modules/phantomjs/lib/phantom
[exec] Phantom installation failed { [Error: ENOTDIR, not a directory '/vagrant/project/node_modules/phantomjs/lib/phantom/bin/phantomjs']
[exec] errno: 27,
[exec] code: 'ENOTDIR',
[exec] path: '/vagrant/project/node_modules/phantomjs/lib/phantom/bin/phantomjs',
[exec] syscall: 'chmod' } Error: ENOTDIR, not a directory '/vagrant/project/node_modules/phantomjs/lib/phantom/bin/phantomjs'
[exec] at Object.fs.chmodSync (evalmachine.<anonymous>:833:18)
[exec] at Object.chmodSync (/vagrant/project/node_modules/phantomjs/node_modules/fs-extra/node_modules/graceful-fs/polyfills.js:141:17)
[exec] at Promise.validExit [as _successFn] (/vagrant/project/node_modules/phantomjs/install.js:145:8)
[exec] at Promise._call (/vagrant/project/node_modules/phantomjs/node_modules/kew/kew.js:373:13)
[exec] at Promise._withInput (/vagrant/project/node_modules/phantomjs/node_modules/kew/kew.js:333:25)
[exec] at Promise.resolve (/vagrant/project/node_modules/phantomjs/node_modules/kew/kew.js:105:27)
[exec] at resolver (/vagrant/project/node_modules/phantomjs/node_modules/kew/kew.js:409:17)
[exec] at CB (/vagrant/project/node_modules/phantomjs/node_modules/fs-extra/node_modules/rimraf/rimraf.js:68:5)
[exec] at Object.oncomplete (fs.js:108:15)
[exec] npm ERR! Linux 3.10.0-123.el7.x86_64
[exec] npm ERR! argv "node" "/usr/bin/npm" "install"
[exec] npm ERR! node v0.10.36
[exec] npm ERR! npm v2.1.5
[exec] npm ERR! code ELIFECYCLE
[exec]
[exec] npm ERR! phantomjs@1.9.15 install: `node install.js`
[exec] npm ERR! Exit status 1
[exec] npm ERR!
[exec] npm ERR! Failed at the phantomjs@1.9.15 install script.
[exec] npm ERR! This is most likely a problem with the phantomjs package,
[exec] npm ERR! not with npm itself.
[exec] npm ERR! Tell the author that this fails on your system:
[exec] npm ERR! node install.js
[exec] npm ERR! You can get their info via:
[exec] npm ERR! npm owner ls phantomjs
[exec] npm ERR! There is likely additional logging output above.
[exec] Writing location.js file
[exec] npm ERR! Linux 3.10.0-123.el7.x86_64
[exec] npm ERR! argv "node" "/usr/bin/npm" "install"
[exec] npm ERR! node v0.10.36
[exec] npm ERR! npm v2.1.5
[exec] npm ERR! path npm-debug.log.a2a87417fd31c590abbf00d595ab39a5
[exec] npm ERR! code ETXTBSY
[exec] npm ERR! errno 62
[exec]
[exec] npm ERR! ETXTBSY, rename 'npm-debug.log.a2a87417fd31c590abbf00d595ab39a5'
[exec] npm ERR!
[exec] npm ERR! If you need help, you may report this error at:
[exec] npm ERR! <http://github.com/npm/npm/issues>
[exec]
[exec] npm ERR! Please include the following file with any support request:
[exec] npm ERR! /vagrant/project/npm-debug.log
好的,我的 "solution" 是我现在在“1.9.10”版本中包含了 PhantomJS,它会在后台从 bitbucket 下载先前的版本,并且不会导致所描述的错误。所以对我来说,NPM 的 PhantomJS 安装脚本的当前版本似乎有问题。
我想在 windows 系统上添加一个解决方案。我希望人们可以找到问题之间的相似之处,并且有些人可能会寻求 windows 的解决方案。
我在 npm install phantomjs 也失败了。我的问题是当我通过 npm 或 yarn 安装时,我无法将 phantomjs-2.1.1-windows.zip 文件下载到临时文件中。错误日志中有一堆can't do command node ./install
这样的杂音,对解决问题没有帮助。
我的解决方案是自己下载 zip 文件,直接进入 \AppData\Local\Temp\phantomjs
并将 zip 文件放在那里,接下来通过 yarn 安装就可以了。
我知道这是一个较旧的问题,但我使用此命令在上次发布的 this wrapper of version 2, specifically for 2.1.1. So I tried to use another mirror, exposed in the official documentation 版本中遇到了同样的问题,并且有效:
npm install --global phantomjs --phantomjs_cdnurl=http://cnpmjs.org/downloads
顺便说一下,PhantomJS is deprecated 还有所有包装纸。