Node.js: Difference between revisions

imported>Makefu
No edit summary
imported>R-k-b
(add a tip to get Node.js binary things running with low investment)
Line 110: Line 110:
   Usage: create-react-app <project-directory> [options]
   Usage: create-react-app <project-directory> [options]
[...]
[...]
</pre>
==== Using <code>npx</code> with binaries ====
Some binaries obtained via npm will not work out of the box with NixOS, as they're dynamically linked to things that don't exist in NixOS (for good reason!)
They'll typically give some kind of `ENOENT` error.
For example, `npx cypress open` might give an error like:
<pre>
$ npx cypress open
Cypress failed to start.
This is usually caused by a missing library or dependency.
The error below should indicate which dependency is missing.
https://on.cypress.io/required-dependencies
If you are using Docker, we provide containers with all required dependencies installed.
----------
spawn /home/rkb/.cache/Cypress/4.10.0/Cypress/Cypress ENOENT
</pre>
One quick workaround for this is to use `steam-run` to provide a placeholder FHS environment that *should* work; e.g. for the Cypress example above:
<pre>
$ nix-env -iA nixos.steam-run
$ steam-run npx cypress open
-- Cypress opens successfully!
</pre>
</pre>