yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.4k stars 2.72k forks source link

yarn corrupts phantomjs binary on reinstall #1607

Open aaronjensen opened 7 years ago

aaronjensen commented 7 years ago

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

Yarn appears to occasionally corrupt the native portion of phantomjs-prebuild, especially when used within docker.

This manifests like this:

# ./node_modules/.bin/phantomjs --version
internal/child_process.js:289
  var err = this._handle.spawn(options);
                         ^

TypeError: Bad argument
    at TypeError (native)
    at ChildProcess.spawn (internal/child_process.js:289:26)
    at exports.spawn (child_process.js:380:9)
    at Object.<anonymous> (/the-link/node_modules/phantomjs-prebuilt/bin/phantomjs:22:10)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.runMain (module.js:590:10)

If the current behavior is a bug, please provide the steps to reproduce.

Our repro is fairly complicated and involves blowing way the yarn cache (though it still seems to happen for us even without the yarn cache being taken away).

See this repo for repro steps: https://github.com/aaronjensen/yarn-repro

Some notes about this repo:

What is the expected behavior?

Yarn would not corrupt phantomjs's binary ever, even if the yarn-cache was gone.

Please mention your node.js, yarn and operating system version.

Node 6.5.0 yarn 0.16.1 Debian 8 (jessie)

Ky6uk commented 7 years ago

Yarn v0.17.2 still broken on it. NPM installs package phantomjs-prebuilt correctly.

OS X Sierra Node.js v7.1.0 phantomjs-prebuit v2.1.13

mheimschild commented 7 years ago

yarn unlike npm does not install phantomjs binary only script relying on it. As a workaround I downloaded phantomjs binary a set PHANTOMJS_BIN env variable pointing to it.

RSO commented 7 years ago

Another fix for this is to run rm -rf node_modules/ and re-run yarn. I'll see if I can investigate this issue a little further.

msteitle commented 7 years ago

Thanks, @RSO. Worked for me. (Still broken as of yarn 0.18.1)