shadcn-ui / ui

Beautifully designed components that you can copy and paste into your apps. Accessible. Customizable. Open Source.
https://ui.shadcn.com
MIT License
74.5k stars 4.61k forks source link

Cannot find module '@ts-morph/common' #2384

Closed ziddkh closed 8 months ago

ziddkh commented 10 months ago

Got an error while init shadcn/ui, this happen when I create new next js app and want installing shadcn/ui. Please help me to fix this

Here's the error that i got

node:internal/modules/cjs/loader:1144
  const err = new Error(message);
              ^

Error: Cannot find module '@ts-morph/common'
Require stack:
- C:\Users\user123\AppData\Local\npm-cache\_npx\125ee17d583c4e03\node_modules\ts-morph\dist\ts-morph.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (C:\Users\user123\AppData\Local\npm-cache\_npx\125ee17d583c4e03\node_modules\ts-morph\dist\ts-morph.js:3:14)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at cjsLoader (node:internal/modules/esm/translators:356:17) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\user123\\AppData\\Local\\npm-cache\\_npx\\125ee17d583c4e03\\node_modules\\ts-morph\\dist\\ts-morph.js'
  ]
}

Node.js v20.11.0

Regards, Zidd

alamenai commented 10 months ago

Would you share your steps of the installation with the screenshots of the terminal?

Did you try install this module?

mauriciomutte commented 10 months ago

I had the same error. Using the latest version npx shadcn-ui@0.6.0 init works fine for me

shadcn commented 8 months ago

This issue has been automatically closed because it received no activity for a while. If you think it was closed by accident, please leave a comment. Thank you.

avhn commented 8 months ago

At C:\Users\user123\AppData\Local\npm-cache the dependency's resolved as not found. Remove the npm-cache at that location and do npm install at project root, it will work.

INGENIO-237 commented 6 months ago

At C:\Users\user123\AppData\Local\npm-cache the dependency's resolved as not found. Remove the npm-cache at that location and do npm install at project root, it will work.

Have tried this solution on Ubuntu but doesn't work.

Screenshot from 2024-04-24 12-38-40

ch1298abhishek commented 6 months ago

did you find any solution for this??

INGENIO-237 commented 6 months ago

did you find any solution for this??

Yeah I did. Just tried the solution suggested by @mauriciomutte. When using npx shadcn-ui@latest .... it was using version 0.2.x of shadcn-ui. So what I did was uninstalling the package and explicitly use npx shadcn-ui@0.6.0 add .... And it worked.

human0821 commented 1 month ago

removing all files in .npm directory resolved the problem for me

amjad-arab commented 1 month ago

i'm also having this issue with my Gatsby project. i didn't add typescript maybe that's why. So how did you solve this issue am i supposed to use old version every time i use this library

node:internal/modules/cjs/loader:1144 const err = new Error(message); ^

Error: Cannot find module '@ts-morph/common' Require stack: