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

npm start error on FreeBSD 14.1 #843

Open
Espionage724 opened this issue Sep 7, 2024 · 6 comments
Open

npm start error on FreeBSD 14.1 #843

Espionage724 opened this issue Sep 7, 2024 · 6 comments

Comments

@Espionage724
Copy link
Contributor

espionage724@Spinesnap:~/Projects/2004Scape-Server/src $ cd ~/'Projects/2004Scape-Server/src' && npm start 

> [email protected] start
> npm i && npm run ts-loader src/lostcity/app.ts


> [email protected] prepare
> husky


up to date, audited 749 packages in 975ms

150 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

> [email protected] ts-loader
> node --import @swc-node/register/esm-register --enable-source-maps --no-warnings src/lostcity/app.ts


node:internal/modules/run_main:129
    triggerUncaughtException(
    ^
Error: Bindings not found.
    at Compiler.<anonymous> (/home/espionage724/Projects/2004Scape-Server/src/node_modules/@swc/core/index.js:228:19)
    at Generator.next (<anonymous>)
    at /home/espionage724/Projects/2004Scape-Server/src/node_modules/@swc/core/index.js:34:71
    at new Promise (<anonymous>)
    at __awaiter (/home/espionage724/Projects/2004Scape-Server/src/node_modules/@swc/core/index.js:30:12)
    at Compiler.transform (/home/espionage724/Projects/2004Scape-Server/src/node_modules/@swc/core/index.js:205:16)
    at transform (/home/espionage724/Projects/2004Scape-Server/src/node_modules/@swc/core/index.js:347:21)
    at transform (/home/espionage724/Projects/2004Scape-Server/src/node_modules/@swc-node/core/index.ts:101:22)
    at compile (/home/espionage724/Projects/2004Scape-Server/src/node_modules/@swc-node/register/register.ts:101:21)
    at load (/home/espionage724/Projects/2004Scape-Server/src/node_modules/@swc-node/register/esm.mts:103:28)

Node.js v20.15.1

Tried with Node/npm 20 and 22 and OpenJDK 20 and 22.

@Espionage724
Copy link
Contributor Author

Espionage724 commented Sep 7, 2024

Doing npm install @swc/core-freebsd-x64 seems to get something different:

node:internal/modules/run_main:129
    triggerUncaughtException(
    ^
[Error: unknown field `keepImportAttributes`, expected one of `plugins`, `keepImportAssertions`, `cacheRoot` at line 1 column 530] {
  code: 'InvalidArg'
}

Which seems related to swc-project/swc#7923 changing keepImportAttributes and keepImportAssertions?

@Espionage724
Copy link
Contributor Author

Espionage724 commented Sep 7, 2024

Tried through Linuxemu with linux_base-rl9 (downloaded Linux prebuilt Node, added PATH/NODE envs) but it looks like it's running into a filesystem-related issue (guessing watch isn't implemented with the Linux layer on FreeBSD?):

> [email protected] ts-loader
> node --import @swc-node/register/esm-register --enable-source-maps --no-warnings src/lostcity/app.ts

Starting world...
Loading game map: 676.127ms
World ready: http://localhost:8888
node:internal/fs/watchers:247
    const error = new UVException({
                  ^

Error: ENOSYS: function not implemented, watch '/home/espionage724/Projects/2004Scape-Server/src/data/src'
    at FSWatcher.<computed> (node:internal/fs/watchers:247:19)
    at Object.watch (node:fs:2468:36)
    at Watcher.watchDirectories (file:///home/espionage724/Projects/2004Scape-Server/src/node_modules/watcher/dist/watcher.js:188:36)
    at file:///home/espionage724/Projects/2004Scape-Server/src/node_modules/watcher/dist/watcher.js:229:51
    at file:///home/espionage724/Projects/2004Scape-Server/src/node_modules/watcher/dist/watcher.js:118:23
    at new Promise (<anonymous>)
    at file:///home/espionage724/Projects/2004Scape-Server/src/node_modules/watcher/dist/watcher.js:117:41
Emitted 'error' event on Watcher instance at:
    at Watcher.error (file:///home/espionage724/Projects/2004Scape-Server/src/node_modules/watcher/dist/watcher.js:57:21)
    at Watcher.watchDirectories (file:///home/espionage724/Projects/2004Scape-Server/src/node_modules/watcher/dist/watcher.js:208:22)
    at file:///home/espionage724/Projects/2004Scape-Server/src/node_modules/watcher/dist/watcher.js:229:51
    [... lines matching original stack trace ...]
    at file:///home/espionage724/Projects/2004Scape-Server/src/node_modules/watcher/dist/watcher.js:117:41 {
  errno: -38,
  syscall: 'watch',
  code: 'ENOSYS',
  path: '/home/espionage724/Projects/2004Scape-Server/src/data/src',
  filename: '/home/espionage724/Projects/2004Scape-Server/src/data/src'
}

Node.js v22.8.0

@Espionage724
Copy link
Contributor Author

Got some error about bcrypt I couldn't workaround with random install commands (save, swc, bcryptjs) with 32-bit Wine, but it almost worked there (node and Adoptium JDK win32 installed easy as-is).

I have some more ideas, but currently I'm still unsure of how to get 2004Scape server running on FreeBSD 14.1.

@Espionage724
Copy link
Contributor Author

Espionage724 commented Sep 16, 2024

I'm out of ideas. It seems like there's something with ts-loader or another dep that when used on FreeBSD runs into the:

unknown field `keepImportAttributes`, expected one of `plugins`, `keepImportAssertions`, `cacheRoot`

error, which implies that something isn't updated with the new swc(?) change that changed ImportAttributes and ImportAssertions around.

npm packaging, dep/resolving, names/versions are all too-messy for me to understand confidently to try to force-install things and I couldn't really get anything outside of solving the initial bindings issue (and seemingly swc trying to use wasm for bindgen) with manually-installing @swc/core-freebsd-x64

  • Running natively got ImportAttributes vs ImportAssertions
  • Running through Wine got issues related to bcrypt
  • Running through Linux layer (c7 or rl9) got ENOSYS errors with FSWatcher

@Espionage724
Copy link
Contributor Author

Anyone have anything about this?

I'm thinking this could be fixed on either 2004Scape's end or swc's. It sounds like with 2004Scape switching keepImportAttributes to keepImportAssertions just for FreeBSD could solve this quick, but I couldn't figure out how to do it that easily from a quick code search.

@Espionage724
Copy link
Contributor Author

Espionage724 commented Oct 4, 2024

With the new no-dev-watcher branch I got it working from a 64-bit Wine prefix (Win10) on FreeBSD 14.1! (notes) I'm mostly fine with running 2004Scape like this :p

But native FreeBSD nodejs/npm still runs into this :

> [email protected] ts-loader
> node --import @swc-node/register/esm-register --enable-source-maps --no-warnings src/lostcity/app.ts


node:internal/modules/run_main:129
    triggerUncaughtException(
    ^
Error: Bindings not found.
    at Compiler.<anonymous> (/home/espionage724/Projects/2004Scape-Server/src/node_modules/@swc/core/index.js:228:19)
    at Generator.next (<anonymous>)
    at /home/espionage724/Projects/2004Scape-Server/src/node_modules/@swc/core/index.js:34:71
    at new Promise (<anonymous>)
    at __awaiter (/home/espionage724/Projects/2004Scape-Server/src/node_modules/@swc/core/index.js:30:12)
    at Compiler.transform (/home/espionage724/Projects/2004Scape-Server/src/node_modules/@swc/core/index.js:205:16)
    at transform (/home/espionage724/Projects/2004Scape-Server/src/node_modules/@swc/core/index.js:347:21)
    at transform (/home/espionage724/Projects/2004Scape-Server/src/node_modules/@swc-node/core/index.ts:101:22)
    at compile (/home/espionage724/Projects/2004Scape-Server/src/node_modules/@swc-node/register/register.ts:101:21)
    at load (/home/espionage724/Projects/2004Scape-Server/src/node_modules/@swc-node/register/esm.mts:103:28)

Node.js v20.15.1
npm verbose cwd /home/espionage724/Projects/2004Scape-Server/src
npm verbose os FreeBSD 14.1-RELEASE-p5
npm verbose node v20.15.1
npm verbose npm  v10.8.1
npm verbose exit 1
npm verbose code 1
npm verbose cwd /home/espionage724/Projects/2004Scape-Server/src
npm verbose os FreeBSD 14.1-RELEASE-p5
npm verbose node v20.15.1
npm verbose npm  v10.8.1
npm verbose exit 1
npm verbose code 1

Or this (after npm install @swc/core-freebsd-x64):

espionage724@Spinesnap:~/Projects/2004Scape-Server/src $ cd ~/'Projects/2004Scape-Server/src' && 'npm' start --verbose
npm verbose cli /usr/local/bin/node /usr/local/bin/npm
npm info using [email protected]
npm info using [email protected]
npm verbose title npm start
npm verbose argv "start" "--loglevel" "verbose"
npm verbose logfile logs-max:10 dir:/home/espionage724/.npm/_logs/2024-10-04T21_38_31_944Z-
npm verbose logfile /home/espionage724/.npm/_logs/2024-10-04T21_38_31_944Z-debug-0.log

> [email protected] start
> npm i && npm run ts-loader src/lostcity/app.ts

npm verbose cli /usr/local/bin/node /usr/local/bin/npm
npm info using [email protected]
npm info using [email protected]
npm verbose title npm i
npm verbose argv "i"
npm verbose logfile logs-max:10 dir:/home/espionage724/.npm/_logs/2024-10-04T21_38_32_043Z-
npm verbose logfile /home/espionage724/.npm/_logs/2024-10-04T21_38_32_043Z-debug-0.log
npm verbose reify failed optional dependency /home/espionage724/Projects/2004Scape-Server/src/node_modules/fsevents
npm verbose reify failed optional dependency /home/espionage724/Projects/2004Scape-Server/src/node_modules/@swc/core-win32-x64-msvc

[bunch of repeated above failed optional dep reify lines snipped]

npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 473ms

> [email protected] prepare
> husky


up to date, audited 746 packages in 1s

151 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
npm verbose cwd /home/espionage724/Projects/2004Scape-Server/src
npm verbose os FreeBSD 14.1-RELEASE-p5
npm verbose node v20.15.1
npm verbose npm  v10.8.1
npm verbose exit 0
npm info ok
npm verbose cli /usr/local/bin/node /usr/local/bin/npm
npm info using [email protected]
npm info using [email protected]
npm verbose title npm run ts-loader src/lostcity/app.ts
npm verbose argv "run" "ts-loader" "src/lostcity/app.ts"
npm verbose logfile logs-max:10 dir:/home/espionage724/.npm/_logs/2024-10-04T21_38_33_122Z-
npm verbose logfile /home/espionage724/.npm/_logs/2024-10-04T21_38_33_122Z-debug-0.log

> [email protected] ts-loader
> node --import @swc-node/register/esm-register --enable-source-maps --no-warnings src/lostcity/app.ts


node:internal/modules/run_main:129
    triggerUncaughtException(
    ^
[Error: unknown field `keepImportAttributes`, expected one of `plugins`, `keepImportAssertions`, `cacheRoot` at line 1 column 530] {
  code: 'InvalidArg'
}

Node.js v20.15.1
npm verbose cwd /home/espionage724/Projects/2004Scape-Server/src
npm verbose os FreeBSD 14.1-RELEASE-p5
npm verbose node v20.15.1
npm verbose npm  v10.8.1
npm verbose exit 1
npm verbose code 1
npm verbose cwd /home/espionage724/Projects/2004Scape-Server/src
npm verbose os FreeBSD 14.1-RELEASE-p5
npm verbose node v20.15.1
npm verbose npm  v10.8.1
npm verbose exit 1
npm verbose code 1

I suspect installing @swc/core-freebsd-x64 here isn't ideal even though it solves the initial Bindings thing (I got the same InvalidArg message even on Termux on Android arm64 after installing its @swc/core Android package).

It sounds like swc/wasm could be used and also solves the Bindings message, but runs into something like:

Error: invalid type: unit value, expected struct Options

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

No branches or pull requests

1 participant