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

Installer fails in docker #37

Closed
mrskug opened this issue Oct 21, 2022 · 5 comments · Fixed by #40
Closed

Installer fails in docker #37

mrskug opened this issue Oct 21, 2022 · 5 comments · Fixed by #40

Comments

@mrskug
Copy link

mrskug commented Oct 21, 2022

Installing purescript 0.15.5+ fails intermittently inside Docker. This happens on node:14 and node:16 but not as frequently on node:16.

Sending build context to Docker daemon  2.048kB
Step 1/3 : FROM node:14
 ---> 2779c31a94ee
Step 2/3 : WORKDIR /app
 ---> Running in b065f91136c7
Removing intermediate container b065f91136c7
 ---> c63b2cb29798
Step 3/3 : RUN npm install purescript@"0.15.6"
 ---> Running in f99acf33f1da

> [email protected] postinstall /app/node_modules/purescript
> install-purescript --purs-ver=0.15.6

[ SUCCESS ] Check if a prebuilt 0.15.6 binary is provided for linux (899ms)
[ SUCCESS ] Download the prebuilt PureScript binary (2s)
[ FAILURE ] Verify the prebuilt binary works correctly
Error: spawn ETXTBSY
    at ChildProcess.spawn (internal/child_process.js:408:11)
    at spawn (child_process.js:677:9)
    at execFile (child_process.js:311:17)
    at child_process.js:221:29
    at Object.complete (/app/node_modules/purescript-installer/download-or-build-purescript/index.js:182:31)
    at notifySubscription (/app/node_modules/zen-observable/lib/Observable.js:145:18)
    at onNotify (/app/node_modules/zen-observable/lib/Observable.js:179:3)
    at SubscriptionObserver.complete (/app/node_modules/zen-observable/lib/Observable.js:245:7)
    at /app/node_modules/purescript-installer/dl-tar/index.js:222:15
    at /app/node_modules/purescript-installer/cancelable-pump/index.js:34:3
    at internal/util.js:435:14
    at finish (internal/streams/pipeline.js:162:7)
    at internal/util.js:435:14
    at InternalUnpack.<anonymous> (internal/streams/pipeline.js:65:7)
    at InternalUnpack.<anonymous> (internal/util.js:435:14)
    at InternalUnpack.onfinish (internal/streams/end-of-stream.js:94:46)

See troubleshooting suggestions in https://github.com/purescript/purescript/blob/master/INSTALL.md

↓ Fallback: building from source

[ FAILURE ] Check if 'stack' command is available
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:277:19)
    at onErrorNT (internal/child_process.js:472:16)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)

See troubleshooting suggestions in https://github.com/purescript/purescript/blob/master/INSTALL.md

npm WARN enoent ENOENT: no such file or directory, open '/app/package.json'
npm WARN app No description
npm WARN app No repository field.
npm WARN app No README data
npm WARN app No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `install-purescript --purs-ver=0.15.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!     /root/.npm/_logs/2022-10-21T09_38_51_311Z-debug.log
The command '/bin/sh -c npm install purescript@"0.15.6"' returned a non-zero code: 1
docker build --no-cache .  5,67s user 0,32s system 15% cpu 37,687 total

Steps to reproduce:

Dockerfile

FROM node:14

WORKDIR /app
RUN npm install purescript@"0.15.6"

build Dockerfile

docker build --no-cache .

repeat until you get the error.

I think it might have to do with changes made to the installer between 0.2.6 and 0.3.1 as purescript 0.15.4 uses version 0.2.6 of the installer and works perfectly every time.

Docker versions tested:

Docker version 20.10.19, build d85ef84533
Docker version 20.10.12, build 20.10.12-0ubuntu4
@sjpeterson
Copy link

For what it's worth, I am experiencing this with node 18.12 and 19.1 as well. I don't have a proper workaround (or root cause analysis, for that matter), but the error is very frequent when installing everything from package.json with a simple npm install, but adding a gratuitous npm install purescript before makes it more manageable.

@rhendric
Copy link
Member

@sjpeterson, does [email protected] also work better for you?

@sjpeterson
Copy link

@rhendric, it does, yes.

@imcotton
Copy link
Contributor

It flaky in Docker more frequently because that's mostly be a fresh install each time (i.e. empty ~/.npm guest folder), actions between pkg fetch, unzip, bin symbolic link, postinstall hook, child process spawn, etc... more likely ravels the racing issue, combine with product versioning between node and npm could also amplify the odds.

@mrskug
Copy link
Author

mrskug commented Dec 7, 2022

Fixed in #40

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