使用NPM / NodeJS安装PhantomJS时出错

时间:2022-04-16 06:30:44

I recently cannot install PhantomJS anymore inside of my Vagrant Box. "npm install phantomjs" fails.

我最近不能再在我的流浪盒子里安装幽灵机器人了。“npm安装phantomjs”失败。

When i check the extracted folder after the installation fails in "/tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2-extract-...", the folder is empty. The results is:

当我在“/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']

So it seems that the installation script has some problems extracting the sources (maybe). Has anybody run into the same problem and solved it? I need to have PhantomJS installed with "npm install" - so manual downloading would not be an option. Thanks!

因此,似乎安装脚本在提取源(可能)时存在一些问题。有人遇到同样的问题并解决了吗?我需要安装有“npm安装”的PhantomJS,所以手动下载是不可能的。谢谢!

"full npm install" output:

“全npm安装”输出:

 [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

2 个解决方案

#1


0  

Ok my "solution" is that I include PhantomJS now in version "1.9.10", which downloads a prior version from bitbucket in the background and doesn't result in the described error. So for me it seems that there is a problem in the current version of the PhantomJS install script for NPM.

好的,我的“解决方案”是我现在在“1.9.10”版本中包含PhantomJS,它从后台的bitbucket下载一个先前的版本,不会导致所描述的错误。因此,对我来说,当前版本的PhantomJS安装脚本中似乎存在一个问题。

#2


0  

I'd like to add a solution on windows system. I hope people may find similarities between the problem and some might seek a solution for windows.

我想在windows系统上添加一个解决方案。我希望人们能找到问题之间的相似之处,也希望有人能找到windows的解决方案。

I also fails at npm install phantomjs. My problem is I can't download the phantomjs-2.1.1-windows.zip file into the temp file when I install by npm or yarn. The error log has a bunch of distraction like can't do command node ./install, which doesn't help solving the problem.

在npm安装phantomjs时,我也会失败。我的问题是我不能下载phantomjs-2.1.1-windows。当我用npm或纱线安装时,将压缩文件压缩到临时文件中。错误日志有很多干扰,比如无法执行命令节点/安装,这无助于解决问题。

My solution was to download the zip file myself, direct into \AppData\Local\Temp\phantomjs and put the zip file there, the next install by yarn works.

我的解决方案是自己下载zip文件,直接下载到\AppData\本地\Temp\phantomjs中,然后把zip文件放在那里,然后由yarn works进行下一次安装。

#1


0  

Ok my "solution" is that I include PhantomJS now in version "1.9.10", which downloads a prior version from bitbucket in the background and doesn't result in the described error. So for me it seems that there is a problem in the current version of the PhantomJS install script for NPM.

好的,我的“解决方案”是我现在在“1.9.10”版本中包含PhantomJS,它从后台的bitbucket下载一个先前的版本,不会导致所描述的错误。因此,对我来说,当前版本的PhantomJS安装脚本中似乎存在一个问题。

#2


0  

I'd like to add a solution on windows system. I hope people may find similarities between the problem and some might seek a solution for windows.

我想在windows系统上添加一个解决方案。我希望人们能找到问题之间的相似之处,也希望有人能找到windows的解决方案。

I also fails at npm install phantomjs. My problem is I can't download the phantomjs-2.1.1-windows.zip file into the temp file when I install by npm or yarn. The error log has a bunch of distraction like can't do command node ./install, which doesn't help solving the problem.

在npm安装phantomjs时,我也会失败。我的问题是我不能下载phantomjs-2.1.1-windows。当我用npm或纱线安装时,将压缩文件压缩到临时文件中。错误日志有很多干扰,比如无法执行命令节点/安装,这无助于解决问题。

My solution was to download the zip file myself, direct into \AppData\Local\Temp\phantomjs and put the zip file there, the next install by yarn works.

我的解决方案是自己下载zip文件,直接下载到\AppData\本地\Temp\phantomjs中,然后把zip文件放在那里,然后由yarn works进行下一次安装。