muse icon indicating copy to clipboard operation
muse copied to clipboard

Running on Raspbian 64 Bit, TypeError: ``Module "file:///opt/muse/dist/package.json" needs an import assertion of type "json"``

Open clemwo opened this issue 3 years ago • 2 comments

I'm trying to run the bot on a Raspberry Zero 2 W.

Environment: cat /etc/os-release:

PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"

node --version: v17.4.0

npm --version: 8.4.1

sudo npm i, sudo npm run build worked fine. But to be honest I had other errors with the build but apparently managed to fix them by upgrading, rebooting and praying to every god known to mankind.

Now when I execute sudo npm run start I get the following error:

[email protected] start
> npm run env:set-database-url -- node --experimental-json-modules dist/src/scripts/migrate-and-start.js


> [email protected] env:set-database-url
> node dist/src/scripts/run-with-database-url.js "node" "--experimental-json-modules" "dist/src/scripts/migrate-and-start.js"

node:internal/errors:464
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "file:///opt/muse/dist/package.json" needs an import assertion of type "json"
    at new NodeError (node:internal/errors:371:5)
    at validateAssertions (node:internal/modules/esm/assert:82:15)
    at defaultLoad (node:internal/modules/esm/load:24:3)
    at ESMLoader.load (node:internal/modules/esm/loader:359:26)
    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:280:58)
    at new ModuleJob (node:internal/modules/esm/module_job:66:26)
    at ESMLoader.#createModuleJob (node:internal/modules/esm/loader:297:17)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:261:34)
    at async ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:81:21)
    at async Promise.all (index 1) {
  code: 'ERR_IMPORT_ASSERTION_TYPE_MISSING'
}

Node.js v17.4.0
file:///opt/muse/node_modules/execa/lib/error.js:59
                error = new Error(message);
                        ^

Error: Command failed with exit code 1: node --experimental-json-modules dist/src/scripts/migrate-and-start.js
    at makeError (file:///opt/muse/node_modules/execa/lib/error.js:59:11)
    at handlePromise (file:///opt/muse/node_modules/execa/index.js:119:26)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async file:///opt/muse/dist/src/scripts/run-with-database-url.js:5:5 {
  shortMessage: 'Command failed with exit code 1: node --experimental-json-modules dist/src/scripts/migrate-and-start.js',
  command: 'node --experimental-json-modules dist/src/scripts/migrate-and-start.js',
  escapedCommand: 'node --experimental-json-modules "dist/src/scripts/migrate-and-start.js"',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: undefined,
  stderr: undefined,
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}

Any help would be appreciated. It would be amazing if the bot would run on a cheap device like this, I cant be the only wanting to host a discord bot on a zero 2 w. Thanks!

clemwo avatar Feb 10 '22 00:02 clemwo

I've never seen that error before. 4a8407c might fix it. Otherwise I'd try downgrading to Node v16.

codetheweb avatar Feb 10 '22 01:02 codetheweb

I've never seen that error before. 4a8407c might fix it. Otherwise I'd try downgrading to Node v16.

Hey, just a little heads-up. I tried using Node v16 but that didnt help either. My current assumption would be that the execa library isnt compatible with the raspbian OS. I'm currently not home and will investigate more once Im home

clemwo avatar Feb 13 '22 17:02 clemwo