statelyai / xstate-tools

Public monorepo for XState tooling
183 stars 36 forks source link

[`@xstate/cli`] Cannot find module 'prettier' no Node 14 #184

Open ghost opened 2 years ago

ghost commented 2 years ago

To reproduce (remove all installed CLI versions: global or local):

npx @xstate/cli typegen index.ts

Errro:

Cannot find module 'prettier'
Require stack:
- /home/i/.npm/_npx/6850/lib/node_modules/@xstate/cli/node_modules/@xstate/tools-shared/dist/xstate-tools-shared.cjs.dev.js
- /home/i/.npm/_npx/6850/lib/node_modules/@xstate/cli/node_modules/@xstate/tools-shared/dist/xstate-tools-shared.cjs.js
- /home/i/.npm/_npx/6850/lib/node_modules/@xstate/cli/bin/bin.js
chentselee commented 1 year ago

Encounter this as well on node 14. Upgrading to node 16 seems to fix the issue

andrecrimb commented 1 year ago

I'm having the same issue. Is prettier actually necessary? 🤔

andrecrimb commented 11 months ago

Any updates about this one?

Andarist commented 11 months ago

@andrecrimb could you prepare a repro case? IIRC we are now loading prettier from the user's project and fallback to a local copy - so this shouldn't happen anymore.

andrecrimb commented 11 months ago

I've checked the latest version and indeed this issue was solved. Thank you @Andarist 🙏🏽