Error: unknown field
cwd
when building Next.js/Payload app

maximilianschmittHOBBY

a year ago

We're building a Next.js / Payload app and it works fine on my local macOS machine. However, on Railway we encounter the following error:

#12 4.472 /app/node_modules/@swc/wasm/wasm.js:489

#12 4.472     const ret = new Error(getStringFromWasm0(arg0, arg1));

#12 4.472                 ^

#12 4.472

#12 4.472 Error: unknown field `cwd`

#12 4.472     at module.exports.__wbindgen_error_new (/app/node_modules/@swc/wasm/wasm.js:489:17)

#12 4.472     at wasm://wasm/047124f6:wasm-function[9674]:0xccbd1f

#12 4.472     at wasm://wasm/047124f6:wasm-function[284]:0x36598c

#12 4.472     at wasm://wasm/047124f6:wasm-function[229]:0x2e91dc

#12 4.472     at wasm://wasm/047124f6:wasm-function[12726]:0xd3f531



#12 4.472     at module.exports.transformSync (/app/node_modules/@swc/wasm/wasm.js:333:14)

#12 4.472     at Compiler.transformSync (/app/node_modules/@swc/core/index.js:251:37)

#12 4.472     at Object.transformSync (/app/node_modules/@swc/core/index.js:351:21)

#12 4.472     at compile (/app/node_modules/@swc/register/lib/node.js:76:22)

#12 4.472     at compileHook (/app/node_modules/@swc/register/lib/node.js:91:16)

#12 4.472

#12 4.472 Node.js v18.18.2



#12 ERROR: process "/bin/bash -ol pipefail -c npm run build" did not complete successfully: exit code: 1

I found this GitHub discussion (https://github.com/swc-project/swc/discussions/7538#discussion-5306254) that talks about fixing the same problem on Windows by installing Visual C++ redistributables.

How do we fix this error on Railway?

Thanks for your help!

View Deploy details

ⓘ Deployment information is only viewable by Project members and Railway admins.

4 Replies

maximilianschmittHOBBY

a year ago

Full logs attached

Attachments


a year ago

Sanity check question: are you committing your node_modules folder to GitHub?


maximilianschmittHOBBY

a year ago

Sanity check question: are you committing your node_modules folder to GitHub?

Nope, not committing node_modules! Just package-lock.json and package.json


a year ago

Have you tried any of the solutions? delete lock file and node_modules and then regen the lock file?