Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug. Yarn couldn't build package phantomjs. npm could. #1016

Closed
sonarct opened this issue Oct 13, 2016 · 32 comments
Closed

Bug. Yarn couldn't build package phantomjs. npm could. #1016

sonarct opened this issue Oct 13, 2016 · 32 comments

Comments

@sonarct
Copy link

sonarct commented Oct 13, 2016

I tried to build this project Github, npm installed all node_modules without errors. But when I tried to do this with Yarn I have got error.
os Archliux 64bit
node v6.7.0
yarn v0.15.1

Building fresh packages... [1/6] ⠁ gifsicle [2/6] ⠁ jpegtran-bin [3/6] ⠁ optipng-bin [6/6] ⠁ phantomjs error /usr/share/nginx/html/123/Travel-Site-Test/node_modules/phantomjs: Command failed. Exit code: 1 Command: sh Arguments: -c node install.js Directory: /usr/share/nginx/html/123/Travel-Site-Test/node_modules/phantomjs Output: PhantomJS not found on PATH Phantom installation failed TypeError: Path must be a string. Received undefined at assertPath (path.js:7:11) at Object.join (path.js:1213:7) at findSuitableTempDirectory (/usr/share/nginx/html/123/Travel-Site-Test/node_modules/phantomjs/install.js:127:30) at /usr/share/nginx/html/123/Travel-Site-Test/node_modules/phantomjs/install.js:476:19 at nextTickCallback (/usr/share/nginx/html/123/Travel-Site-Test/node_modules/kew/kew.js:47:28) at _combinedTickCallback (internal/process/next_tick.js:67:7) at process._tickCallback (internal/process/next_tick.js:98:9) TypeError: Path must be a string. Received undefined at assertPath (path.js:7:11) at Object.join (path.js:1213:7) at findSuitableTempDirectory (/usr/share/nginx/html/123/Travel-Site-Test/node_modules/phantomjs/install.js:127:30) at /usr/share/nginx/html/123/Travel-Site-Test/node_modules/phantomjs/install.js:476:19 at nextTickCallback (/usr/share/nginx/html/123/Travel-Site-Test/node_modules/kew/kew.js:47:28) at _combinedTickCallback (internal/process/next_tick.js:67:7) at process._tickCallback (internal/process/next_tick.js:98:9) at SpawnError (/usr/lib/node_modules/yarn/lib/errors.js:18:1) at ChildProcess.proc.on.code (/usr/lib/node_modules/yarn/lib/util/child.js:107:15) at emitTwo (events.js:106:13) at ChildProcess.emit (events.js:191:7) at maybeClose (internal/child_process.js:877:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

@jaygarcia
Copy link

I think i opened a similar issue: #1015

@markstos
Copy link
Contributor

Looks like a dupe of #987, which also mentions a failed PhantomJS installation. (#1015 mentioned above was closed as a dupe of the same ticket).

@igorshubovych
Copy link

It is not exactly duplicate. They fixed it in stringstream, but it still does not work in PhantomJS. I would reopen it.

@markstos
Copy link
Contributor

markstos commented Nov 9, 2016

@igorshubovych did you try phantomjs-prebuilt instead (which is the latest version of phantomjs)? I wonder if the old phantomjs package was itself buggy, but npm happened to work with it.

@noherczeg
Copy link

Updating phantomjs-prebuilt to v2.1.8 fixed the problem for me.

@hetzijzo
Copy link

hetzijzo commented Feb 3, 2017

I can reproduce the issue.
I have karma-phantomjs-launcher@1.0.2 and phantomjs-prebuilt@2.1.14.

When I run yarn install I get the following error:

error /media/willem/DATA/Projects/Essent/service-api/node_modules/phantomjs: Command failed
...
Output
PhantomJS not found on PATH
Phantom installation failed TypeError: Path must be a string. Received undefined

With npm install PhantomJS installs fine.

Why was this issue closed?

@estevaoam
Copy link

I'm having the same issue here.
I've already tried all solutions above.

@mazavr
Copy link

mazavr commented Feb 9, 2017

Having the issue.
yarn v.0.19.1

"devDependencies": {
  ...  
  "karma-phantomjs-launcher": "1.0.2",
  "phantomjs": "2.1.7"
}

yarn --no-bin-links

PhantomJS not found on PATH
Phantom installation failed [TypeError: Path must be a string. Received undefined] TypeError: Path must be a string. Received undefined

@ilaif
Copy link

ilaif commented Feb 20, 2017

@markstos Can this be reopened? A few people have been experiencing this issue after #987 was closed. Thanks!

@markstos
Copy link
Contributor

@ilaif I don't have the ability to re-open it, but I'll mention @cpojer who does.

I still recommend using phantomjs-prebuilt instead (which is the latest version of phantomjs). With so many open issues, I could understand if the Yarn project chooses not to allocate resources fixing compatibility with an old, buggy package when yarn already works with the newer, recommended version of the package.

@sixinli
Copy link

sixinli commented Feb 24, 2017

seeing this in yarn@0.19.1 also

@csvan
Copy link

csvan commented Feb 28, 2017

@markstos this is not an issue with the old package only. I can reproduce this with yarn 0.20.3 and phantomjs-prebuilt 2.1.14.

However, this is only reproducible under Linux. On Windows 7 under Cygwin it works fine.

@cpojer please consider reopening this as it clearly isn't resolved. A lot of build environments depend on phantomjs for testing etc, so this is a major blocker for using Yarn in them.

@markstos
Copy link
Contributor

@csvan Could you post the output of your failure to build phantomjs-prebuilt on Linux?

@sonarct
Copy link
Author

sonarct commented Feb 28, 2017

@markstos Good day. There is no more problem with yarn and package phantomjs-prebuilt. I installed it successfully just now.
OS: Arch Linux 4.9.9-1
nodejs: v7.5.0
yarn: v0.21.3

Thanks to all

xm@localhost:http/testtest $ yarn add phantomjs-prebuilt yarn add v0.21.3 info No lockfile found. [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... [4/4] Building fresh packages... success Saved lockfile. success Saved 90 new dependencies.

@csvan
Copy link

csvan commented Feb 28, 2017

@markstos getting this on CentOS 7 when running yarn install in a project with "phantomjs-prebuilt": "^2.1.14" as a dep. Using Node 6.9.5. and Yarn 0.20.3:

[INFO] [4/4] Building fresh packages...
[ERROR] error /opt/balthazar/workdir/web/node_modules/phantomjs: Command failed.
[ERROR] Exit code: 1
[ERROR] Command: sh
[ERROR] Arguments: -c node install.js
[ERROR] Directory: /opt/balthazar/workdir/web/node_modules/phantomjs
[ERROR] Output:
[ERROR] PhantomJS not found on PATH
[ERROR] Phantom installation failed TypeError: Path must be a string. Received undefined
[ERROR]     at assertPath (path.js:7:11)
[ERROR]     at Object.join (path.js:1211:7)
[ERROR]     at findSuitableTempDirectory (/opt/balthazar/workdir/web/node_modules/phantomjs/install.js:127:30)
[ERROR]     at /opt/balthazar/workdir/web/node_modules/phantomjs/install.js:476:19
[ERROR]     at nextTickCallback (/opt/balthazar/workdir/web/node_modules/kew/kew.js:47:28)
[ERROR]     at _combinedTickCallback (internal/process/next_tick.js:67:7)
[ERROR]     at process._tickCallback (internal/process/next_tick.js:98:9) TypeError: Path must be a string. Received undefined
[ERROR]     at assertPath (path.js:7:11)
[ERROR]     at Object.join (path.js:1211:7)
[ERROR]     at findSuitableTempDirectory (/opt/balthazar/workdir/web/node_modules/phantomjs/install.js:127:30)
[ERROR]     at /opt/balthazar/workdir/web/node_modules/phantomjs/install.js:476:19
[ERROR]     at nextTickCallback (/opt/balthazar/workdir/web/node_modules/kew/kew.js:47:28)
[ERROR]     at _combinedTickCallback (internal/process/next_tick.js:67:7)
[ERROR]     at process._tickCallback (internal/process/next_tick.js:98:9)
[INFO] info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

@markstos
Copy link
Contributor

markstos commented Feb 28, 2017

@csvan Your failure is in "findSuitableTempDirectory". You apparently don't have permission to write to several possible temp directories on your system. See:

https://github.com/Medium/phantomjs/blob/master/install.js#L105

That appears to be your problem, not yarns. Try again after setting your own environment variable to a working value: npm_config_tmp=/some/tmp/dir/you/can/actually/write/to yarn install.

I used yarn to install phantomjs-prebuilt without problems (on Ubuntu Linux).

@csvan
Copy link

csvan commented Feb 28, 2017

@markstos great catch, I will try that. Does NPM do this by default? The above project builds fine with NPM 3.10, it only fails under Yarn.

@csvan
Copy link

csvan commented Feb 28, 2017

@markstos nvm, just noticed NPM does set this var whereas Yarn doesn't. My problem is thus actually this issue: #1538. Thanks for your help!

@the-teacher
Copy link

the-teacher commented Mar 13, 2017

This toolset works for me

centos
node: v6.9.4
yarn: 0.21.3
"karma-phantomjs-launcher": "^1.0.2",
"phantomjs-prebuilt": "2.1.8",

@dcecile
Copy link

dcecile commented May 4, 2017

It looks like this has been fixed in phantomjs-prebuilt v2.1.8 via Medium/phantomjs@5e6598f.

(If you're finding this bug because you're using prerender-spa-plugin, that package has an open issue to upgrade from phantomjs-prebuilt v2.1.7 where it's currently stuck due to a Windows problem -- see chrisvfritz/prerender-spa-plugin#36.)

GHaberis added a commit to guardian/mobile-apps-article-templates that referenced this issue May 5, 2017
justmoon added a commit to interledger-deprecated/ilp-kit that referenced this issue May 10, 2017
The package phantomjs is actually just an older version of
phantomjs-prebuilt. This older version has a bug which makes it crash
when trying to install with yarn.

See: yarnpkg/yarn#1016 (comment)

In fact, since karma-phantomjs-launcher already installs
phantomjs-prebuilt (and we don't actually use PhantomJS other than
through that module), we don't also need to depend on it at all.
justmoon added a commit to interledger-deprecated/ilp-kit that referenced this issue May 10, 2017
The package phantomjs is actually just an older version of
phantomjs-prebuilt. This older version has a bug which makes it crash
when trying to install with yarn.

See: yarnpkg/yarn#1016 (comment)

In fact, since karma-phantomjs-launcher already installs
phantomjs-prebuilt (and we don't actually use PhantomJS other than
through that module), we don't also need to depend on it at all.
justmoon added a commit to interledger-deprecated/ilp-kit that referenced this issue May 11, 2017
The package phantomjs is actually just an older version of
phantomjs-prebuilt. This older version has a bug which makes it crash
when trying to install with yarn.

See: yarnpkg/yarn#1016 (comment)

In fact, since karma-phantomjs-launcher already installs
phantomjs-prebuilt (and we don't actually use PhantomJS other than
through that module), we don't also need to depend on it at all.
michielbdejong pushed a commit to interledger-deprecated/ilp-kit that referenced this issue May 17, 2017
The package phantomjs is actually just an older version of
phantomjs-prebuilt. This older version has a bug which makes it crash
when trying to install with yarn.

See: yarnpkg/yarn#1016 (comment)

In fact, since karma-phantomjs-launcher already installs
phantomjs-prebuilt (and we don't actually use PhantomJS other than
through that module), we don't also need to depend on it at all.
@mikestead
Copy link

mikestead commented Jun 6, 2017

If you switch over to phantomjs-prebuilt to solve this problem, you then can't run it in an Alpine based docker container as it's not built for musl... so you also have to change your Linux distro... or make a custom build of phantom

@csvan
Copy link

csvan commented Jun 17, 2017

For anyone still having this issue, I recommend switching over to Chrome Headless. It does everything phantom does better, and is actively supported across all platforms.

@moneytree-doug
Copy link

@mikestead How does that work? Do I have to remove the launcher?

@xahon
Copy link

xahon commented Sep 26, 2017

The same problem

@kaylie-alexa
Copy link
Member

@xahon maybe you can try #1538 (comment)?

fred1218zh pushed a commit to fred1218zh/ilp-kit that referenced this issue Sep 27, 2017
The package phantomjs is actually just an older version of
phantomjs-prebuilt. This older version has a bug which makes it crash
when trying to install with yarn.

See: yarnpkg/yarn#1016 (comment)

In fact, since karma-phantomjs-launcher already installs
phantomjs-prebuilt (and we don't actually use PhantomJS other than
through that module), we don't also need to depend on it at all.
@synzhang
Copy link

I had the same problem,try yarn global add phantomjs-prebuilt.

@dapi
Copy link

dapi commented Mar 28, 2018

same problem

@markstos
Copy link
Contributor

@dapi you should provide the version of phantom that you are having trouble installing. Try 2.1.16 (or newer)

@blaskovicz
Copy link

What @markstos said except also replace phantomjs with phantomjs-prebuilt in package.json.

@jdavmo
Copy link

jdavmo commented Jul 7, 2018

I had the same issue, it works installing phantomjs-prebuilt@2.1.16

@Nick-Caris
Copy link

This works for me:

TMPDIR=/tmp yarn install

@BRAiNCHiLD95
Copy link

Adding phantomjs-prebuilt to the global packages fixed it for me.

I had the same problem,try yarn global add phantomjs-prebuilt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests