Medium / phantomjs

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

npm install failed for webpack template #787

Closed Helenbj closed 6 years ago

Helenbj commented 6 years ago

helen@helen-Lenovo-Product:~/Documents/vuejs/my-project$ npm install npm WARN deprecated socks@1.1.10: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0

phantomjs-prebuilt@2.1.16 install /home/helen/Documents/vuejs/my-project/node_modules/phantomjs-prebuilt node install.js

PhantomJS not found on PATH Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2 Saving to /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 Receiving... [=======---------------------------------] 17% Error making request. Error: read ECONNRESET at TLSWrap.onread (net.js:602:25)

Please report this full log at https://github.com/Medium/phantomjs npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE npm ERR! errno 1 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. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

┌─────────────────────────────────────────────────────────┐ │ npm update check failed │ │ Try running with sudo or get access │ │ to the local update config store via │ │ sudo chown -R $USER:$(id -gn $USER) /home/helen/.config │ └─────────────────────────────────────────────────────────┘

npm ERR! A complete log of this run can be found in: npm ERR! /home/helen/.npm/_logs/2018-03-29T03_55_33_559Z-debug.log

The detail log as bellow: 41620 warn optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/fsevents): 41621 warn notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) 41622 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS: darwin 41622 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch: any 41622 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS: linux 41622 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64 41623 verbose stack Error: phantomjs-prebuilt@2.1.16 install: node install.js 41623 verbose stack Exit status 1 41623 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:283:16) 41623 verbose stack at EventEmitter.emit (events.js:180:13) 41623 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14) 41623 verbose stack at ChildProcess.emit (events.js:180:13) 41623 verbose stack at maybeClose (internal/child_process.js:936:16) 41623 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5) 41624 verbose pkgid phantomjs-prebuilt@2.1.16 41625 verbose cwd /home/helen/Documents/vuejs/my-project 41626 verbose Linux 4.4.0-87-generic 41627 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" 41628 verbose node v9.9.0 41629 verbose npm v5.8.0 41630 error code ELIFECYCLE 41631 error errno 1 41632 error phantomjs-prebuilt@2.1.16 install: node install.js 41632 error Exit status 1 41633 error Failed at the phantomjs-prebuilt@2.1.16 install script. 41633 error This is probably not a problem with npm. There is likely additional logging output above. 41634 verbose exit [ 1, true ]

Helenbj commented 6 years ago

This problem has been solved by myself. As you can see "PhantomJS not found on PATH", this means program cannot find "phantomjs-2.1.1-linux-x86_64.tar.bz2" in local path "/tmp/phantomjs/". Then I open the default download url "https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2", which returns none, there may be some firewall rules made by China government. The solution as bellow:

  1. download "phantomjs-2.1.1-linux-x86_64.tar.bz2" from url "https://cnpmjs.org/downloads"
  2. move the downloaded "phantomjs-2.1.1-linux-x86_64.tar.bz2" to local directory "/tmp/phantomjs/"
  3. re-run command "npm install", the output as bellow npminstall
DanielRuf commented 6 years ago

No, phantomjs first checks if there is a globally installed version on your $PATH setting and then checks for prebuilt binary releases.