Medium / phantomjs

NPM wrapper for installing phantomjs
Other
1.42k stars 436 forks source link

npm install failed for version 2.1.7 #782

Open vinodtelang-sdn opened 6 years ago

vinodtelang-sdn commented 6 years ago

Have tried to install version 2.1.7, but it failed.

npm install phantomjs@2.1.7 --save

adrianjarc commented 6 years ago

Same happening here (happened today). Here is my log from console when i run npm i:


> phantomjs-prebuilt@2.1.16 install /home/adrian/work/mightyfields/worker/node_modules/phantom/node_modules/phantomjs-prebuilt
> node install.js

/home/adrian/work/mightyfields/worker/node_modules/phantom/node_modules/sntp/lib/index.js:19
exports.time = async function (options = {}) {
                     ^^^^^^^^

SyntaxError: Unexpected token function
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:387:25)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/adrian/work/mightyfields/worker/node_modules/phantom/node_modules/hawk/lib/index.js:5:16)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)

npm ERR! Linux 4.4.0-116-generic
npm ERR! argv "/home/adrian/.nvm/versions/node/v5.12.0/bin/node" "/home/adrian/.nvm/versions/node/v5.12.0/bin/npm" "i"
npm ERR! node v5.12.0
npm ERR! npm  v3.8.6
npm ERR! code ELIFECYCLE

npm ERR! phantomjs-prebuilt@2.1.16 install: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the phantomjs-prebuilt@2.1.16 install script 'node install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the phantomjs-prebuilt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs phantomjs-prebuilt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls phantomjs-prebuilt
npm ERR! There is likely additional logging output above.

and running npm i --verbose:

> phantomjs-prebuilt@2.1.16 install /home/adrian/work/mightyfields/worker/node_modules/phantom/node_modules/phantomjs-prebuilt
> node install.js

/home/adrian/work/mightyfields/worker/node_modules/phantom/node_modules/sntp/lib/index.js:19
exports.time = async function (options = {}) {
                     ^^^^^^^^

SyntaxError: Unexpected token function
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:387:25)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/adrian/work/mightyfields/worker/node_modules/phantom/node_modules/hawk/lib/index.js:5:16)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
npm verb lifecycle phantomjs-prebuilt@2.1.16~install: unsafe-perm in lifecycle true
npm verb lifecycle phantomjs-prebuilt@2.1.16~install: PATH: /home/adrian/.nvm/versions/node/v5.12.0/lib/node_modules/npm/bin/node-gyp-bin:/home/adrian/work/mightyfields/worker/node_modules/phantom/node_modules/phantomjs-prebuilt/node_modules/.bin:/home/adrian/work/mightyfields/worker/node_modules/phantom/node_modules/.bin:/home/adrian/work/mightyfields/worker/node_modules/.bin:/home/adrian/.nvm/versions/node/v5.12.0/bin:/home/adrian/.sdkman/candidates/gradle/current/bin:/home/adrian/.nvm/versions/node/v5.12.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/jdk1.8.0_162/bin:/home/adrian/Android/Sdk/platform-tools:/home/adrian/Android/Sdk/tools:/home/adrian/Android/Sdk/tools/bin:/usr/local/poedit-1.8.13/src
npm verb lifecycle phantomjs-prebuilt@2.1.16~install: CWD: /home/adrian/work/mightyfields/worker/node_modules/phantom/node_modules/phantomjs-prebuilt
npm info lifecycle phantomjs-prebuilt@2.1.16~install: Failed to exec install script
npm verb unlock done using /home/adrian/.npm/_locks/staging-8097edc6fde9be22.lock for /home/adrian/work/mightyfields/worker/node_modules/.staging
mfworker@2.9.3 /home/adrian/work/mightyfields/worker
└── (empty)

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.1.3
npm verb stack Error: phantomjs-prebuilt@2.1.16 install: `node install.js`
npm verb stack Exit status 1
npm verb stack     at EventEmitter.<anonymous> (/home/adrian/.nvm/versions/node/v5.12.0/lib/node_modules/npm/lib/utils/lifecycle.js:239:16)
npm verb stack     at emitTwo (events.js:100:13)
npm verb stack     at EventEmitter.emit (events.js:185:7)
npm verb stack     at ChildProcess.<anonymous> (/home/adrian/.nvm/versions/node/v5.12.0/lib/node_modules/npm/lib/utils/spawn.js:24:14)
npm verb stack     at emitTwo (events.js:100:13)
npm verb stack     at ChildProcess.emit (events.js:185:7)
npm verb stack     at maybeClose (internal/child_process.js:850:16)
npm verb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
npm verb pkgid phantomjs-prebuilt@2.1.16
npm verb cwd /home/adrian/work/mightyfields/worker
npm ERR! Linux 4.4.0-116-generic
npm ERR! argv "/home/adrian/.nvm/versions/node/v5.12.0/bin/node" "/home/adrian/.nvm/versions/node/v5.12.0/bin/npm" "i" "--verbose"
npm ERR! node v5.12.0
npm ERR! npm  v3.8.6
npm ERR! code ELIFECYCLE

npm ERR! phantomjs-prebuilt@2.1.16 install: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the phantomjs-prebuilt@2.1.16 install script 'node install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the phantomjs-prebuilt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs phantomjs-prebuilt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls phantomjs-prebuilt
npm ERR! There is likely additional logging output above.
npm verb exit [ 1, true ]

npm ERR! code 1
nick13jaremek commented 6 years ago

Same problem here.

It seems the issue is in the request package. Six days ago, it upgraded its hawk dependency from version 6.x to version 7.x, as seen in this commit:

https://github.com/request/request/commit/cfd230708c5a0a5c09935d5f1074f43de6e9c010

This hawk library uses the sntp library which appears on the logs provided by @TheDeathStreaker.

phantomsjs relies on the request library, but uses a caret to allow npm to install minor and patch versions.

Since request applied the previously referenced commit and upgraded the dependency version as a patch from version 2.8.40 to 2.8.41, the phantomjs repo is broken on installation for several node versions (mine is version 6.9.5).

EDIT:

I missed out the versioning on the request library. There was an minor version upgrade, from 2.83.0 to 2.84.0, which is the culprit of the error described in this issue.

Therefore: It would be better to have a fixed request version in the phantomjs package.json file, namely 2.83.x .

juansev commented 6 years ago

for your information, the versions 2.1.14 and below are working. downgrade in the meanwhile if possible

npm install phantomjs-prebuilt@2.1.14

nick13jaremek commented 6 years ago

I created pull request #783 to resolve this issue.

Wlada commented 6 years ago

Can someone merge pull above?

smec-cgint commented 6 years ago

Downgrading to versions 2.1.14 worked for us as well for the moment. A solution that supports using newer versions would be nice though