payload
payload copied to clipboard
Missing package @swc/core when installing with Yarn
Link to reproduction
No response
Payload Version
3.0.0-beta.55
Node Version
v20.15.0
Next.js Version
15.0.0-rc.0
Describe the Bug
The package @swc/core is a required peerDependency of @swc-node/core but it's not installed when using Yarn as package manager (pnpm seems to install it; I have not tested npm but a Discord message indicated it faces the same issue).
Reproduction Steps
git clone [email protected]:payloadcms/payload-3.0-demo payload-swc-core-repro
cd payload-swc-core-repro
rm pnpm-lock.yaml
echo 'nodeLinker: node-modules' > .yarnrc.yml
yarn
yarn payload generate:types
Adapters and Plugins
No response
@mvarendorff which version of yarn are you using?
Test was run with Yarn 4.1.1 @AlessioGr ; my bad for not including that!
I'm running Node 20.11.1 with NPM 10.2.4
On beta 67 it can't run even if we add the deps:
"@swc/cli": "0.3.12", "@swc/core": "1.4.14", "@swc/types": "0.1.10",
In previous beta it ran this way now we get:
`> payload generate:types
node:internal/modules/run_main:115
triggerUncaughtException(
^
Error: Cannot find module '@swc/types'
Require stack:
- /home/user/dev/canary/cm-website/packages/payload/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@swc/core/index.js
- /home/user/dev/canary/cm-website/packages/payload/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]__@[email protected]/node_modules/@swc-node/core/lib/index.js `
Eventually on 67 I removed next 3 deps and all working o.k. now:
"@swc/cli": "0.3.12", "@swc/core": "1.4.14", "@swc/types": "0.1.10",
Apparently I added them in previous versions , now it causes problems
@AlessioGr is this still relevant? Can you check into this?
@AlessioGr is this still relevant? Can you check into this?
This is relevant, I have the same error, node v18.20.3, yarn v1.22.19.
$ cross-env NODE_OPTIONS=--no-deprecation payload
node:internal/process/esm_loader:40
internalBinding('errors').triggerUncaughtException(
^
Error: Cannot find module '@swc/core'
Require stack:
- /home/user/payloadadmin/node_modules/@swc-node/core/lib/index.js
This is relevant, I have the same error, node v18.20.3, yarn v1.22.19.
yarn v1 is not supported anymore.
I'll still investigate this breaking on Yarn 4.1.1 and npm
Same issue on node v21, yarn 4.4.0 while running payload generate:types
Fixed it locally by installing Speedy Web Compiler manually: yarn add -D @swc/cli @swc/core
Fixed in latest v3 release - we now use tsx instead of swc for our bin scripts
This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.