curiousdannii / parchment

The Interactive Fiction web app
https://iplayif.com
MIT License
421 stars 60 forks source link

Parchment build instructions are wrong #123

Closed dfabulich closed 2 years ago

dfabulich commented 2 years ago

Do a fresh checkout of Parchment, and run git submodule update --init --recursive. Then run npm install.

The build will fail, because asyncglk hasn't been built.

[11:06:50] Error: Could not resolve '../upstream/asyncglk/dist/blorb/iff.js' from src/common/launcher.js
dfabulich commented 2 years ago

I think the optimal fix for this is to push a release of asyncglk to npm, then update Parchment to depend on asyncglk via npm, with a link-local-asyncglk script https://github.com/curiousdannii/parchment/pull/113

…and then update the Parchment documentation to explain how to hack on asyncglk (or emglken, for that matter) in Parchment.

curiousdannii commented 2 years ago

Already fixed in testing :)

Oh, except that it might not work with the npm version of Emglken. (I didn't set up an alias thing with esbuild.) There's a couple of changes I want to make to Emglken and then I'll publish a new version on npm, which was already what I was planning to work on next.

dfabulich commented 2 years ago

The testing branch fails to build on my machine.

> parchment@2022.4.0 prepare
> ./build.js

✘ [ERROR] Could not resolve "path"

    node_modules/emglken/build/hugo-core.js:71:28:
      71 │   scriptDirectory = require("path").dirname(scriptDirectory) + "/";
         ╵                             ~~~~~~

  The package "path" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "fs"

    node_modules/emglken/build/hugo-core.js:76:32:
      76 │   if (!nodeFS) nodeFS = require("fs");
         ╵                                 ~~~~

  The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle
  for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "path"

    node_modules/emglken/build/git-core.js:71:28:
      71 │   scriptDirectory = require("path").dirname(scriptDirectory) + "/";
         ╵                             ~~~~~~

  The package "path" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "fs"

    node_modules/emglken/build/git-core.js:76:32:
      76 │   if (!nodeFS) nodeFS = require("fs");
         ╵                                 ~~~~

  The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle
  for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "path"

    node_modules/emglken/build/tads-core.js:71:28:
      71 │   scriptDirectory = require("path").dirname(scriptDirectory) + "/";
         ╵                             ~~~~~~

  The package "path" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "fs"

    node_modules/emglken/build/tads-core.js:76:32:
      76 │   if (!nodeFS) nodeFS = require("fs");
         ╵                                 ~~~~

  The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle
  for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "path"

    node_modules/emglken/build/glulxe-core.js:71:28:
      71 │   scriptDirectory = require("path").dirname(scriptDirectory) + "/";
         ╵                             ~~~~~~

  The package "path" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

✘ [ERROR] Could not resolve "fs"

    node_modules/emglken/build/glulxe-core.js:76:32:
      76 │   if (!nodeFS) nodeFS = require("fs");
         ╵                                 ~~~~

  The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle
  for node? You can use "platform: 'node'" to do that, which will remove this error.

/private/tmp/tp/parchment/node_modules/esbuild/lib/main.js:1603
  let error = new Error(`${text}${summary}`);
              ^

Error: Build failed with 8 errors:
node_modules/emglken/build/git-core.js:71:28: ERROR: Could not resolve "path"
node_modules/emglken/build/git-core.js:76:32: ERROR: Could not resolve "fs"
node_modules/emglken/build/glulxe-core.js:71:28: ERROR: Could not resolve "path"
node_modules/emglken/build/glulxe-core.js:76:32: ERROR: Could not resolve "fs"
node_modules/emglken/build/hugo-core.js:71:28: ERROR: Could not resolve "path"
...
    at failureErrorWithLog (/private/tmp/tp/parchment/node_modules/esbuild/lib/main.js:1603:15)
    at /private/tmp/tp/parchment/node_modules/esbuild/lib/main.js:1249:28
    at runOnEndCallbacks (/private/tmp/tp/parchment/node_modules/esbuild/lib/main.js:1162:65)
    at buildResponseToResult (/private/tmp/tp/parchment/node_modules/esbuild/lib/main.js:1247:7)
    at /private/tmp/tp/parchment/node_modules/esbuild/lib/main.js:1356:14
    at /private/tmp/tp/parchment/node_modules/esbuild/lib/main.js:666:9
    at handleIncomingPacket (/private/tmp/tp/parchment/node_modules/esbuild/lib/main.js:763:9)
    at Socket.readFromStdout (/private/tmp/tp/parchment/node_modules/esbuild/lib/main.js:632:7)
    at Socket.emit (node:events:527:28)
    at addChunk (node:internal/streams/readable:324:12) {
  errors: [
    {
      detail: undefined,
      location: {
        column: 28,
        file: 'node_modules/emglken/build/git-core.js',
        length: 6,
        line: 71,
        lineText: '  scriptDirectory = require("path").dirname(scriptDirectory) + "/";',
        namespace: '',
        suggestion: ''
      },
      notes: [
        {
          location: null,
          text: `The package "path" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.`
        }
      ],
      pluginName: '',
      text: 'Could not resolve "path"'
    },
    {
      detail: undefined,
      location: {
        column: 32,
        file: 'node_modules/emglken/build/git-core.js',
        length: 4,
        line: 76,
        lineText: '  if (!nodeFS) nodeFS = require("fs");',
        namespace: '',
        suggestion: ''
      },
      notes: [
        {
          location: null,
          text: `The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.`
        }
      ],
      pluginName: '',
      text: 'Could not resolve "fs"'
    },
    {
      detail: undefined,
      location: {
        column: 28,
        file: 'node_modules/emglken/build/glulxe-core.js',
        length: 6,
        line: 71,
        lineText: '  scriptDirectory = require("path").dirname(scriptDirectory) + "/";',
        namespace: '',
        suggestion: ''
      },
      notes: [
        {
          location: null,
          text: `The package "path" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.`
        }
      ],
      pluginName: '',
      text: 'Could not resolve "path"'
    },
    {
      detail: undefined,
      location: {
        column: 32,
        file: 'node_modules/emglken/build/glulxe-core.js',
        length: 4,
        line: 76,
        lineText: '  if (!nodeFS) nodeFS = require("fs");',
        namespace: '',
        suggestion: ''
      },
      notes: [
        {
          location: null,
          text: `The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.`
        }
      ],
      pluginName: '',
      text: 'Could not resolve "fs"'
    },
    {
      detail: undefined,
      location: {
        column: 28,
        file: 'node_modules/emglken/build/hugo-core.js',
        length: 6,
        line: 71,
        lineText: '  scriptDirectory = require("path").dirname(scriptDirectory) + "/";',
        namespace: '',
        suggestion: ''
      },
      notes: [
        {
          location: null,
          text: `The package "path" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.`
        }
      ],
      pluginName: '',
      text: 'Could not resolve "path"'
    },
    {
      detail: undefined,
      location: {
        column: 32,
        file: 'node_modules/emglken/build/hugo-core.js',
        length: 4,
        line: 76,
        lineText: '  if (!nodeFS) nodeFS = require("fs");',
        namespace: '',
        suggestion: ''
      },
      notes: [
        {
          location: null,
          text: `The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.`
        }
      ],
      pluginName: '',
      text: 'Could not resolve "fs"'
    },
    {
      detail: undefined,
      location: {
        column: 28,
        file: 'node_modules/emglken/build/tads-core.js',
        length: 6,
        line: 71,
        lineText: '  scriptDirectory = require("path").dirname(scriptDirectory) + "/";',
        namespace: '',
        suggestion: ''
      },
      notes: [
        {
          location: null,
          text: `The package "path" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.`
        }
      ],
      pluginName: '',
      text: 'Could not resolve "path"'
    },
    {
      detail: undefined,
      location: {
        column: 32,
        file: 'node_modules/emglken/build/tads-core.js',
        length: 4,
        line: 76,
        lineText: '  if (!nodeFS) nodeFS = require("fs");',
        namespace: '',
        suggestion: ''
      },
      notes: [
        {
          location: null,
          text: `The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.`
        }
      ],
      pluginName: '',
      text: 'Could not resolve "fs"'
    }
  ],
  warnings: []
}

Node.js v17.8.0
dfabulich commented 2 years ago

Note that git clean -xdf isn't enough to repro Parchment build errors, because it only scrubs the top-level project; you'd then have to git clean -xdf on each submodule (or at least emglken) to reproduce issues.

curiousdannii commented 2 years ago

Yep, that's the emglken alias thing I mentioned. The gulpfile sets up import alias for the Node stuff, but I hafven't worked out how to do that with Esbuild yet.

Edit: Worked it out.

go2tom42 commented 2 years ago

I'm having a issue

Fresh install of Ubuntu 20.04 LTS

Command ran

sudo apt install git
sudo apt install npm
git clone https://github.com/curiousdannii/parchment
cd parchment
git submodule update --init --recursive
npm install

Result

npm install

> parchment@2022.4.0 prepare
> ./build.js

file:///home/tom42/Desktop/test/parchment/build.js:54
        copy: await readdir('src/fonts/iosevka'),
              ^^^^^

SyntaxError: Unexpected reserved word
    at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18)
    at async link (internal/modules/esm/module_job.js:42:21)
npm ERR! code 1
npm ERR! path /home/tom42/Desktop/test/parchment
npm ERR! command failed
npm ERR! command sh -c ./build.js

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/tom42/.npm/_logs/2022-04-14T04_01_28_406Z-debug-0.log

Full log file https://raw.githubusercontent.com/go2tom42/Frotz-UEFI/main/2022-04-14T04_01_28_406Z-debug-0.log

dfabulich commented 2 years ago

You’re on Node 12. Upgrade to Node 14 or higher to fix this.

curiousdannii commented 2 years ago

Yes sorry, the build script uses top-level await, which requires 14.8 or later. Node 12 reaches end of life in 2 weeks. Try to update to Node 16 if you can. Or in less than a week Node 18 is scheduled to be released. (Even major version numbers are all LTS.)

go2tom42 commented 2 years ago

That fixed it, thank you both

namekuseijin commented 2 years ago

I had this same issue, but simply running ./build --serve or something manually worked...

Em qui, 14 de abr de 2022 01:11, tom42 @.***> escreveu:

I'm having a issue

Fresh install of Ubuntu 20.04 LTS

Command ran

git clone https://github.com/curiousdannii/parchment cd parchment git submodule update --init --recursive npm install

Result

npm install

@.*** prepare ./build.js

file:///home/tom42/Desktop/test/parchment/build.js:54 copy: await readdir('src/fonts/iosevka'), ^^^^^

SyntaxError: Unexpected reserved word at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18) at async link (internal/modules/esm/module_job.js:42:21) npm ERR! code 1 npm ERR! path /home/tom42/Desktop/test/parchment npm ERR! command failed npm ERR! command sh -c ./build.js

npm ERR! A complete log of this run can be found in: npm ERR! /home/tom42/.npm/_logs/2022-04-14T04_01_28_406Z-debug-0.log

Full log file https://raw.githubusercontent.com/go2tom42/Frotz-UEFI/main/2022-04-14T04_01_28_406Z-debug-0.log

— Reply to this email directly, view it on GitHub https://github.com/curiousdannii/parchment/issues/123#issuecomment-1098690627, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHVQEW6ZGGZGNHCBMGOWN7LVE6LIPANCNFSM5TEAAUEQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>