swc-project / swc-node

Faster ts-node without typecheck
MIT License
1.76k stars 73 forks source link

New 1.9.0 version package causes error #653

Closed namitoyokota closed 2 years ago

namitoyokota commented 2 years ago

Here is the error message on yarn install: image

Brooooooklyn commented 2 years ago

It works fine on my mac:

yarn add @swc-node/register typescript -D
yarn add v1.22.18
info No lockfile found.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...

success Saved lockfile.
success Saved 14 new dependencies.
info Direct dependencies
├─ @swc-node/register@1.5.0
└─ typescript@4.6.3
info All dependencies
├─ @swc-node/core@1.9.0
├─ @swc-node/register@1.5.0
├─ @swc-node/sourcemap-support@0.2.0
├─ @swc/core-darwin-arm64@1.2.172
├─ @swc/core@1.2.172
├─ buffer-from@1.1.2
├─ colorette@2.0.16
├─ debug@4.3.4
├─ ms@2.1.2
├─ pirates@4.0.5
├─ source-map-support@0.5.21
├─ source-map@0.6.1
├─ tslib@2.4.0
└─ typescript@4.6.3
✨  Done in 1.84s.
daniellrsouza commented 2 years ago

I'm facing the same problem here.

Invariant Violation: could not find a copy of typescript to link in C:\Users\my-user\workspace\my-project\node_modules\@swc-node\register\node_modules

What can I do to fix it?

Brooooooklyn commented 2 years ago

@daniellrsouza please provide this information so I can debug it:

Iress-AlexNorris commented 2 years ago

I'm getting the same issue but I'm baffled as I'm not sure where we're getting this package from:

error An unexpected error occurred: "could not find a copy of typescript to link in ...\...\\node_modules\\@swc-node\\register\\node_modules".

OS: Windows 10 Enterprise, 10.0.19042 build 19042 Node v: 16.13.0 Pkg manager: Yarn (v1.22.17) but running npm in the background (v8.1.3) Repro steps: Nuking our yarn.lock file and node modules with npx rimraf then running yarn install.

Brooooooklyn commented 2 years ago

I've done a quick fix in https://github.com/swc-project/swc-node/releases/tag/%40swc-node%2Fregister%401.5.1 Could you try does it work for you?

daniellrsouza commented 2 years ago

I've done a quick fix in https://github.com/swc-project/swc-node/releases/tag/%40swc-node%2Fregister%401.5.1 Could you try doest it work for you?

I was answering you with my information (OS, OS version, Node version etc) but this fix worked for me! =)

namitoyokota commented 2 years ago

This worked for me as well. The issue was with Angular 13 version only supporting up to TypeScript 4.4.4.

Iress-AlexNorris commented 2 years ago

Yep worked for me and for the same reason as above, thank you @Brooooooklyn!