Skip to content

Installing the purescript npm package fails #21

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

Closed
skykanin opened this issue May 7, 2020 · 17 comments
Closed

Installing the purescript npm package fails #21

skykanin opened this issue May 7, 2020 · 17 comments

Comments

@skykanin
Copy link

skykanin commented May 7, 2020

Description

Installing purescript through npm i -g purescript fails with output shown underneath. Also tried installing the package in a local project, but got the same error.
Full debug log here

npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
/home/skykanin/.npm-global/bin/purs -> /home/skykanin/.npm-global/lib/node_modules/purescript/purs.bin

> [email protected] postinstall /home/skykanin/.npm-global/lib/node_modules/purescript
> install-purescript --purs-ver=0.13.6

✔ Check if a prebuilt 0.13.6 binary is provided for linux (1s)
✔ Download the prebuilt PureScript binary (9s)
✖ Verify the prebuilt binary works correctly
  /home/skykanin/.npm-global/lib/node_modules/purescript/purs.bin --version
  Error: spawn /home/skykanin/.npm-global/lib/node_modules/purescript/purs.bin ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19)
    at onErrorNT (internal/child_process.js:468:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
▬ Save the downloaded binary to the npm cache directory

↓ Fallback: building from source

✖ Check if 'stack' command is available
  stack --allow-different-user --numeric-version
  Error: Command failed with exit code 2 (ENOENT): stack --allow-different-user --numeric-version
spawn stack ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19)
    at onErrorNT (internal/child_process.js:468:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
▬ Download the PureScript 0.13.6 source
▬ Ensure the appropriate GHC is installed
▬ Build a binary from source
▬ Save the built binary to the npm cache directory

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `install-purescript --purs-ver=0.13.6`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/skykanin/.npm/_logs/2020-05-07T17_45_44_600Z-debug.log

To Reproduce

  1. Run npm i -g purescript

Expected behavior

I expect the package to install correctly without failure.

Additional context

OS Info:

  • OS: NixOS 20.09 (Nightingale) x86_64
  • Kernel: 5.6.7
  • CPU: Intel i5-6600 (4) @ 3.900GHz
  • GPU: NVIDIA GeForce GTX 1070
  • Memory: 15963MiB

Npm info:

  • Npm version: 6.14.4
  • Npm config:
  • File: /home/skykanin/.npmrc
    • prefix=~/.npm-global

Allows npm packages to be installed globally on NixOS

PureScript version

0.13.6

@hdgarrood
Copy link
Collaborator

Thanks for the report!

@hdgarrood hdgarrood transferred this issue from purescript/purescript May 8, 2020
@hdgarrood
Copy link
Collaborator

This looks similar to #16

@hdgarrood
Copy link
Collaborator

Can you check whether a file /home/skykanin/.npm-global/lib/node_modules/purescript/purs.bin exists directly after running this command? Also, if so, can you post the output of ldd /home/skykanin/.npm-global/lib/node_modules/purescript/purs.bin please?

@hdgarrood
Copy link
Collaborator

Oh also, is there a file /lib64/ld-linux-x86-64.so.2 on your system?

@skykanin
Copy link
Author

skykanin commented May 8, 2020

There is no /home/skykanin/.npm-global/lib/node_modules/purescript directory after running the install command, nor is there a /lib64/ld-linux-x86-64.so.2 file on my system

@hdgarrood
Copy link
Collaborator

Ok, thanks. The file lib64/ld-linux-x86-64.so.2 is the dynamic loader for the purs binary, so if it doesn't exist on your system, it means that the prebuilt binaries aren't suitable for your system. You'll have to build the compiler from source. Hopefully, that should be as simple as getting stack installed and on your PATH, and rerunning npm i -g purescript.

@skykanin
Copy link
Author

skykanin commented May 8, 2020

After installing stack npm i -g purescript now fails on a different step Ensure the appropriate GHC is installed. I have GHC version 8.6.5 installed. Is a different version required to build purescript 0.13.6?

@hdgarrood
Copy link
Collaborator

That seems odd, stack should take care of installing the appropriate GHC for you. Could you post the whole output please?

@skykanin
Copy link
Author

skykanin commented May 8, 2020

npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
/home/skykanin/.npm-global/bin/purs -> /home/skykanin/.npm-global/lib/node_modules/purescript/purs.bin

> [email protected] postinstall /home/skykanin/.npm-global/lib/node_modules/purescript
> install-purescript --purs-ver=0.13.6

✔ Check if a prebuilt 0.13.6 binary is provided for linux (1s)
✔ Download the prebuilt PureScript binary (10s)
✖ Verify the prebuilt binary works correctly
  /home/skykanin/.npm-global/lib/node_modules/purescript/purs.bin --version
  Error: spawn /home/skykanin/.npm-global/lib/node_modules/purescript/purs.bin ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19)
    at onErrorNT (internal/child_process.js:468:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
▬ Save the downloaded binary to the npm cache directory

↓ Fallback: building from source

✔ Check if 'stack' command is available
	2.1.3.1 found at /home/skykanin/.nix-profile/bin/stack
✔ Download the PureScript 0.13.6 source (2s)
✖ Ensure the appropriate GHC is installed (2m)
  stack setup
  Error: Command failed with exit code 1 (EPERM): stack --allow-different-user setup
    at makeError (/home/skykanin/.npm-global/lib/node_modules/purescript/node_modules/execa/lib/error.js:59:11)
    at handlePromise (/home/skykanin/.npm-global/lib/node_modules/purescript/node_modules/execa/index.js:112:26)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
▬ Build a binary from source
▬ Save the built binary to the npm cache directory

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `install-purescript --purs-ver=0.13.6`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/skykanin/.npm/_logs/2020-05-08T14_28_15_246Z-debug.log

@hdgarrood
Copy link
Collaborator

Thanks. The EPERM suggests a permissions error. Unfortunately it's not clear from the error message what the program was trying to do which caused this error. Could you please try downloading the PureScript sources manually and running the same command? That is:

$ stack update
$ stack unpack purescript
$ cd purescript-0.13.6
$ stack setup

@skykanin
Copy link
Author

skykanin commented May 8, 2020

On the last step stack setup I get this error I don't know how to install GHC on your system configuration, please install manually

@skykanin
Copy link
Author

skykanin commented May 8, 2020

Ok, I think I found the issue. In the purescript source code stack.yaml file nix is disabled which causes the setup to fail on nix systems. So I changed it to true which fixed the issue. Not sure how you would fix this for the npm install script tho

@hdgarrood
Copy link
Collaborator

Maybe we could try to detect whether we are on a nix system and pass the --nix flag to Stack, which should have the same effect? I'm not sure.

@skykanin
Copy link
Author

skykanin commented May 8, 2020

Yes, that sounds like it would fix the issue

@hdgarrood
Copy link
Collaborator

I've created #22, #23, and #24 to address the problems encountered here, so I'm going to close this in favour of those. Thanks again for the report!

@fdietze
Copy link

fdietze commented Oct 22, 2020

Couldn't the prebuilt binaries be linked statically instead? I'm wondering if that's an easier solution that could make the npm approach more portable.

@hdgarrood
Copy link
Collaborator

They could, but it’s not that easy to set up.

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

3 participants