payloadcms / payload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
https://payloadcms.com
MIT License
28.59k stars 1.77k forks source link

Missing package @swc/core when installing with Yarn #7005

Open mvarendorff2 opened 4 months ago

mvarendorff2 commented 4 months ago

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 git@github.com: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

AlessioGr commented 4 months ago

@mvarendorff which version of yarn are you using?

mvarendorff2 commented 4 months ago

Test was run with Yarn 4.1.1 @AlessioGr ; my bad for not including that!

mvdve commented 4 months ago

I'm running Node 20.11.1 with NPM 10.2.4

tsemachh commented 4 months ago

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:

tsemachh commented 4 months ago

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

jmikrut commented 4 months ago

@AlessioGr is this still relevant? Can you check into this?

ansbr commented 3 months ago

@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
AlessioGr commented 3 months ago

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

btielen commented 3 months ago

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