purescript / purescript/npm-installer

Building from source doesn't seem to work

Open
#41 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
10
Forks
15
PR merge metrics
No merged PRs in 30d

Description

I was trying to force the installer to build PureScript from source by modifying supportedPlatforms (removing all platforms) and architecture check (so it would always be false). When doing so, the installer fails with the following output:

/.../npm-installer (master*=) % node index.js --purs-ver=0.15.7                           
✖ Check if a prebuilt 0.15.7 binary is provided for linux
  No prebuilt PureScript binary is provided for x64 architecture.

See troubleshooting suggestions in https://github.com/purescript/purescript/blob/master/INSTALL.md
▬ Download the prebuilt PureScript binary
▬ Verify the prebuilt binary works correctly
▬ Save the downloaded binary to the npm cache directory

↓ Fallback: building from source

/.../npm-installer/node_modules/zen-observable/lib/Observable.js:65
      throw e;
      ^

TypeError: Cannot read properties of undefined (reading 'has')
    at getCurrentTask (/.../npm-installer/index.js:308:24)
    at Object.next (/.../npm-installer/index.js:376:16)
    at notifySubscription (/.../npm-installer/node_modules/zen-observable/lib/Observable.js:135:18)
    at onNotify (/.../npm-installer/node_modules/zen-observable/lib/Observable.js:179:3)
    at SubscriptionObserver.next (/.../npm-installer/node_modules/zen-observable/lib/Observable.js:235:7)
    at Object.next (/.../npm-installer/install-purescript/index.js:89:15)
    at notifySubscription (/.../npm-installer/node_modules/zen-observable/lib/Observable.js:135:18)
    at onNotify (/.../npm-installer/node_modules/zen-observable/lib/Observable.js:179:3)
    at SubscriptionObserver.next (/.../npm-installer/node_modules/zen-observable/lib/Observable.js:235:7)
    at /.../npm-installer/download-or-build-purescript/index.js:246:13

Node.js v19.6.1

The problem is somewhat fixed with the following patch (the output would be slightly messed up. I guess there's a better fix):

diff --git a/index.js b/index.js
index 3164858..f6398f8 100755
--- a/index.js
+++ b/index.js
@@ -160,6 +160,13 @@ const taskGroups = [
                ]
        ]),
        new TaskGroup([
+               [
+                       'head',
+                       {
+                               head: 'Build from source',
+                               status: 'processing'
+                       }
+               ],
                [
                        'check-stack',
                        {

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the source-build fallback with node index.js --purs-ver=0.15.7, then inspect index.js around taskGroups, getCurrentTask at line 308, and the task transition at line 376. The fix is complete when the fallback no longer throws while selecting the build task and the installer output remains coherent through the build process.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.