ui icon indicating copy to clipboard operation
ui copied to clipboard

Cannot find module '@ts-morph/common'

Open ziddkh opened this issue 5 months ago • 2 comments

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

ziddkh avatar Jan 11 '24 17:01 ziddkh

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

Did you try install this module?

alamenai avatar Jan 14 '24 01:01 alamenai

I had the same error. Using the latest version npx [email protected] init works fine for me

mauriciomutte avatar Jan 14 '24 15:01 mauriciomutte

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.

shadcn avatar Feb 29 '24 23:02 shadcn

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.

avhn avatar Mar 13 '24 18:03 avhn

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

INGENIO-237 avatar Apr 24 '24 11:04 INGENIO-237

did you find any solution for this??

ch1298abhishek avatar Apr 27 '24 08:04 ch1298abhishek

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 [email protected] add .... And it worked.

INGENIO-237 avatar Apr 27 '24 09:04 INGENIO-237