gpt4 book ai didi

node.js - FreeBSD phantomJS安装问题

转载 作者:太空宇宙 更新时间:2023-11-04 02:17:05 25 4
gpt4 key购买 nike

运行下面的命令后

root@hz:/data/www/node # npm i phantomjs

我明白了

npm WARN deprecated phantomjs@2.1.3: Package renamed to phantomjs-prebuilt. Please update 'phantomjs' package references to 'phantomjs-prebuilt'

> phantomjs@2.1.3 install /data/www/node/node_modules/phantomjs
> node install.js

Looks like an `npm install -g`; unable to check for already installed version.
Downloading https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-macosx.zip
Saving to /data/www/node/node_modules/phantomjs/phantomjs/phantomjs-2.1.1-macosx.zip
Receiving...
[=======================================-] 98%
Received 16746K total.
Extracting zip contents
Removing /data/www/node/node_modules/phantomjs/lib/phantom
Copying extracted folder /data/www/node/node_modules/phantomjs/phantomjs/phantomjs-2.1.1-macosx.zip-extract-1454690434788/phantomjs-2.1.1-macosx -> /data/www/node/node_modules/phantomjs/lib/phantom
Writing location.js file
Done. Phantomjs binary available at /data/www/node/node_modules/phantomjs/lib/phantom/bin/phantomjs
npm ERR! FreeBSD 9.3-RELEASE
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "i" "phantomjs"
npm ERR! node v5.4.1
npm ERR! npm v2.14.7
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package handlebars@4.0.2 does not satisfy its siblings' peerDependencies requirements!

npm ERR! Please include the following file with any support request:
npm ERR! /data/www/node/npm-debug.log

似乎要安装 phantomjs,但是当我尝试获取 phantomjs 版本

root@hz:/data/www/node # phantomjs --version

我明白了

/usr/local/lib/node_modules/phantomjs/lib/phantom/bin/phantomjs: 1: Syntax error: Unterminated quoted string
/usr/local/lib/node_modules/phantomjs/lib/phantom/bin/phantomjs: 1: Syntax error: Error in command substitution
root@hz:/data/www/node #

有谁知道这个问题怎么解决吗?我需要运行应该使用 phantom.JS 的 Node.JS 服务器,但是当预计使用它时,我会收到下一个错误

[Error: PhantomJS exited with return value 2]

最佳答案

您遇到了 Node 包管理器/phantomjs 的 NPM 包的一个众所周知的错误 - 即使您运行的是 FreeBSD,它也会安装 phantomjs 的 macOS 版本:

> phantomjs@2.1.3 install /data/www/node/node_modules/phantomjs
> node install.js
...
Downloading https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-macosx.zip

查看此 PhantomJS 问题:

https://github.com/ariya/phantomjs/issues/12963

或者,您可以从源代码安装 phantomjs; FreeBSD 有一个端口可以做到这一点:

masheen(~) # cd /usr/ports/lang/phantomjs
masheen(~) # make install

关于node.js - FreeBSD phantomJS安装问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35228267/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com