Skip to content
/ vue-cli Public
  • Sponsor vuejs/vue-cli

  • Notifications You must be signed in to change notification settings
  • Fork 6.3k

Typescript generator not working #943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dbulic opened this issue Mar 5, 2018 · 15 comments
Closed

Typescript generator not working #943

dbulic opened this issue Mar 5, 2018 · 15 comments
Labels

Comments

@dbulic
Copy link

dbulic commented Mar 5, 2018

Version

3.0.0-beta.3

Reproduction link

https://codesandbox.io/s/kx4k47zlx3

Steps to reproduce

vue create project
vue-router, sass, babel, typescript OR just typescript without anything else

What is expected?

Project to be created

What is actually happening?

Vue CLI v3.0.0-beta.4
? Please pick a preset: Manually select features
? Check the features needed for your project: TS
? Use class-style component syntax? Yes
? Use Babel alongside TypeScript for auto-detected polyfills? Yes
? Where do you prefer placing config for Babel, PostCSS, ESLint, etc.? In dedicated config files

🚀 Invoking generators...
ERROR Error: Cannot find module '@vue/cli-service/generator/template/src/App.vue'
Error: Cannot find module '@vue/cli-service/generator/template/src/App.vue'
at Function.Module._resolveFilename (module.js:536:15)
at Function.resolve (internal/module.js:18:19)
at renderFile (/usr/local/share/.config/yarn/global/node_modules/@vue/cli/lib/GeneratorAPI.js:226:17)
at _injectFileMiddleware (/usr/local/share/.config/yarn/global/node_modules/@vue/cli/lib/GeneratorAPI.js:141:27)
at
at process._tickCallback (internal/process/next_tick.js:188:7)


Actually Vue CLI v3.0.0-beta.4, but Version dropdown doesn't offer it.

@yyx990803
Copy link
Member

Hmm... can't reproduce. Just did a fresh install with what your prompts are and it worked as expected.

@cyantree
Copy link

cyantree commented Mar 5, 2018

It seems @vue/cli-service needs to be installed along otherwise the dependency can't be resolved.

@dbulic
Copy link
Author

dbulic commented Mar 5, 2018

damir@5giga:/app/air$ vue create client


Vue CLI v3.0.0-beta.4
? Please pick a preset: Manually select features
? Check the features needed for your project: TS
? Use class-style component syntax? Yes
? Use Babel alongside TypeScript for auto-detected polyfills? Yes
? Where do you prefer placing config for Babel, PostCSS, ESLint, etc.? In package.json
? Save this as a preset for future projects? No


Vue CLI v3.0.0-beta.4
✨  Creating project in /app/air/client.
🗃  Initializing git repository...
⚙  Installing CLI plugins. This might take a while...

yarn install v1.0.2
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.1.3: The platform "linux" is incompatible with this module.



success Saved lockfile.
Done in 21.40s.

🚀  Invoking generators...
 ERROR  Error: Cannot find module '@vue/cli-service/generator/template/src/App.vue'
Error: Cannot find module '@vue/cli-service/generator/template/src/App.vue'
    at Function.Module._resolveFilename (module.js:536:15)
    at Function.resolve (internal/module.js:18:19)
    at renderFile (/usr/local/share/.config/yarn/global/node_modules/@vue/cli/lib/GeneratorAPI.js:226:17)
    at _injectFileMiddleware (/usr/local/share/.config/yarn/global/node_modules/@vue/cli/lib/GeneratorAPI.js:141:27)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
damir@5giga:/app/air$ 

Forgot to mention I use Ubuntu 17.10, though not sure that makes a difference. I went to another machine now, installed latest vue-cli (used yarn global add). Exact same issue.
If there is anything else I can do to pinpoint the problem, do let me know.

@dbulic
Copy link
Author

dbulic commented Mar 5, 2018

Yep, I can confirm that sudo yarn global add @vue/cli-service solves the issue.

@mikekidder
Copy link

I get same error @dbulic at "Invoking generators..." I am on Windows 10; used npm

@sebbean
Copy link

sebbean commented May 24, 2018

requiring sudo yarn global add @vue/cli-service seems wrong? isn't that what's trying to be avoided by the new version?
seems related to #1105

@beatgrabe
Copy link

For those writing their own presets or generators.js and facing this error, you do not need to install the @vue/cli-service globally. Just provide it as a devDependencies in your related project.

@whj768702
Copy link

For those writing their own presets or generators.js and facing this error, you do not need to install the @vue/cli-service globally. Just provide it as a devDependencies in your related project.

thanks

@rposener
Copy link

This is very broken again. I did find the templates in cli-plugin-typescript so have been able to fix myself.

Steps to Create issue:

  1. npm init vite-app
  2. vue add typescript (take all defaults)

Error:

�  Invoking generator for @vue/cli-plugin-typescript...
 ERROR  Error: Cannot find module '@vue/cli-service/generator/template/src/App.vue' from ....

@jtbaker
Copy link

jtbaker commented Oct 1, 2020

This is very broken again. I did find the templates in cli-plugin-typescript so have been able to fix myself.

☝️ Same here

@marcelruiter
Copy link

@jtbaker how did you fix it? i'm facing the same problem and it's very anoying

@edgexie
Copy link

edgexie commented Dec 28, 2020

@rposener same teminal steps and get same error~

I manually installed @vue/cli-service and it is working reference
npm install --save-dev @vue/cli-service

@jtbaker
Copy link

jtbaker commented Dec 28, 2020

@jtbaker how did you fix it? i'm facing the same problem and it's very anoying

I think I wound up copying over my tsconfig.json package.json and vue.config.js settings from an existing project.

@ManeeshDev
Copy link

@rposener same teminal steps and get same error~

I manually installed @vue/cli-service and it is working reference
npm install --save-dev @vue/cli-service

It works..👌

@jiyuuki
Copy link

jiyuuki commented May 14, 2022

i also add : vue add router

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests