Skip to content

Installing phantomjs-prebuilt fails due to no npm_config_tmpΒ #1538

@joshkel

Description

@joshkel

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

Bug (maybe - Yarn's behavior is not necessarily incorrect, but it's incompatible with NPM)

What is the current behavior?

yarn add phantomjs fails with the following error:

error /home/jkelley/t2/node_modules/phantomjs: Command failed.
Exit code: 1
Command: sh
Arguments: -c node install.js
Directory: /home/jkelley/test/node_modules/phantomjs
Output:
PhantomJS not found on PATH
Phantom installation failed [TypeError: Path must be a string. Received undefined] TypeError: Path must be a string. Received undefined
    at assertPath (path.js:8:11)
    at Object.posix.join (path.js:479:5)
    at findSuitableTempDirectory (/home/jkelley/t2/node_modules/phantomjs/install.js:127:30)
    at /home/jkelley/test/node_modules/phantomjs/install.js:476:19
    at nextTickCallback (/home/jkelley/t2/node_modules/kew/kew.js:47:28)
    at nextTickCallbackWith0Args (node.js:420:9)
    at process._tickCallback (node.js:349:13)

Investigation revealed that the problem is that phantomjs 2.1.7 unconditionally expected the npm_config_tmp environment variable to be passed down by NPM. Yarn doesn't do this, so Yarn fails to install phantomjs in cases where NPM succeeds.

This is probably a bug in the phantomjs package (the current phantomjs-prebuilt package fixes it), but phantomjs is a popular package and probably not the only package to make this mistake, so it would improve Yarn's compatibility with NPM to pass npm_config_tmp.

A simple workaround for phantomjs in particular is to set TMPDIR before calling yarn.

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

yarn add phantomjs

What is the expected behavior?

yarn add phantomjs works.

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

Node 4.6.1, Yarn 0.16.1, Ubuntu 14.04

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions