payload icon indicating copy to clipboard operation
payload copied to clipboard

Missing package @swc/core when installing with Yarn

Open mvarendorff2 opened this issue 1 year ago • 9 comments
trafficstars

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

mvarendorff2 avatar Jul 02 '24 06:07 mvarendorff2

@mvarendorff which version of yarn are you using?

AlessioGr avatar Jul 02 '24 16:07 AlessioGr

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

mvarendorff2 avatar Jul 02 '24 16:07 mvarendorff2

I'm running Node 20.11.1 with NPM 10.2.4

mvdve avatar Jul 06 '24 15:07 mvdve

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 avatar Jul 21 '24 05:07 tsemachh

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

tsemachh avatar Jul 21 '24 12:07 tsemachh

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

jmikrut avatar Jul 29 '24 20:07 jmikrut

@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

ansbr avatar Aug 09 '24 19:08 ansbr

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

AlessioGr avatar Aug 09 '24 19:08 AlessioGr

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

btielen avatar Aug 12 '24 10:08 btielen

Fixed in latest v3 release - we now use tsx instead of swc for our bin scripts

AlessioGr avatar Jan 14 '25 20:01 AlessioGr

This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.

github-actions[bot] avatar Jan 16 '25 04:01 github-actions[bot]