purescript / npm-installer

ISC License
10 stars 13 forks source link

Building from source doesn't seem to work #41

Open keijokapp opened 1 year ago

keijokapp commented 1 year ago

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',
                        {