Medium / phantomjs

NPM wrapper for installing phantomjs
Other
1.43k stars 435 forks source link

fails build on node 0.12/0.12/4 #580

Closed anthonyettinger closed 8 years ago

anthonyettinger commented 8 years ago
> phantomjs-prebuilt@2.1.8 install /home/jenkins/workspace/nb/apim-ui~master/5570eb3e/node_modules/phantomjs-prebuilt
> node install.js

module.js:327
    throw err;
    ^

Error: Cannot find module './ber/index'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/home/jenkins/workspace/nb/apim-ui~master/5570eb3e/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/lib/index.js:6:11)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
rmg commented 8 years ago

Other incarnations from the other 2 node versions listed:

> phantomjs-prebuilt@2.1.8 install /home/jenkins/workspace/nb/apim-ui~master/d8d6f573/node_modules/phantomjs-prebuilt
> node install.js

module.js:340
    throw err;
    ^
Error: Cannot find module 'boom'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/jenkins/workspace/nb/apim-ui~master/d8d6f573/node_modules/request/node_modules/hawk/lib/index.js:3:33)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
> phantomjs-prebuilt@2.1.8 install /home/jenkins/workspace/nb/apim-ui~master/95f23c5f/node_modules/phantomjs-prebuilt
> node install.js

/home/jenkins/workspace/nb/apim-ui~master/95f23c5f/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/index.js:41
});

SyntaxError: Unexpected end of input
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/home/jenkins/workspace/nb/apim-ui~master/95f23c5f/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js:21:23)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
rmg commented 8 years ago

A pretty good example of the non-deterministic install problem of npm@2 and the related dangers of using dependencies inside install scripts.

Unfortunately it's a bit of a roulette situation where some releases get hit harder than others :-/

nicks commented 8 years ago

ya, this is an npm2 bug. you need to wipe out your dependency tree and reinstall. there's nothing we can do to fix this; it happens because npm2 puts your dependency tree in a bad state.

rmg commented 8 years ago

you need to wipe out your dependency tree and reinstall

Not really a valid option in the automated, headless CI environments this module is basically built for - is it?

there's nothing we can do to fix this

I believe the correct fix is to bundle the deps which are expected to be present during installation

it happens because npm2 puts your dependency tree in a bad state.

The tree is in an undefined state during installation. The bug is expecting otherwise.

rmg commented 8 years ago

@nicks I published a forked version as bundled-phantomjs-prebuilt@2.1.8-0 where the only difference is bundling the dependencies and it resolved the problem for the 3 different environments described above.

Unfortunately, because package name is different, it doesn't prevent sub-dependencies from pulling in phantomjs-prebuilt which continues to fail for the above cited reasons :-(

rmg commented 8 years ago

Opened #585 to more formally propose my solution.