Skip to content

Failed generator invoking #3309

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
kazupon opened this issue Jan 15, 2019 · 4 comments · Fixed by #4003
Closed

Failed generator invoking #3309

kazupon opened this issue Jan 15, 2019 · 4 comments · Fixed by #4003

Comments

@kazupon
Copy link
Member

kazupon commented Jan 15, 2019

Version

3.3.0

Reproduction link

https://no.link

Environment info


Environment Info:

  System:
    OS: macOS High Sierra 10.13.6
    CPU: (4) x64 Intel(R) Core(TM) i5-7Y54 CPU @ 1.20GHz
  Binaries:
    Node: 11.6.0 - ~/bin/.nvm/versions/node/v11.6.0/bin/node
    Yarn: 1.13.0 - ~/bin/.nvm/versions/node/v11.6.0/bin/yarn
    npm: 6.5.0-next.0 - ~/bin/.nvm/versions/node/v11.6.0/bin/npm
  Browsers:
    Chrome: 71.0.3578.98
    Firefox: 61.0.2
    Safari: 12.0.2
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0-beta.2 
    @vue/babel-plugin-transform-vue-jsx:  1.0.0-beta.2 
    @vue/babel-preset-app:  3.3.0 
    @vue/babel-preset-jsx:  1.0.0-beta.2 
    @vue/babel-sugar-functional-vue:  1.0.0-beta.2 
    @vue/babel-sugar-inject-h:  1.0.0-beta.2 
    @vue/babel-sugar-v-model:  1.0.0-beta.2 
    @vue/babel-sugar-v-on:  1.0.0-beta.2 
    @vue/cli-overlay:  3.3.0 
    @vue/cli-plugin-babel: ^3.3.0 => 3.3.0 
    @vue/cli-plugin-eslint: ^3.3.0 => 3.3.0 
    @vue/cli-service: ^3.3.0 => 3.3.0 
    @vue/cli-shared-utils:  3.3.0 
    @vue/component-compiler-utils:  2.5.0 
    @vue/preload-webpack-plugin:  1.1.0 
    @vue/web-component-wrapper:  1.2.0 
    babel-helper-vue-jsx-merge-props:  2.0.3 
    babel-plugin-transform-vue-jsx:  4.0.1 
    eslint-plugin-vue: ^5.0.0 => 5.1.0 
    vue: ^2.5.21 => 2.5.22 
    vue-eslint-parser:  4.0.3 
    vue-hot-reload-api:  2.3.1 
    vue-loader:  15.5.1 
    vue-style-loader:  4.1.2 
    vue-template-compiler: ^2.5.21 => 2.5.22 
    vue-template-es2015-compiler:  1.8.1 
  npmGlobalPackages:
    @vue/cli: 3.3.0

Steps to reproduce

  1. vue create repro1 with default (babel, eslint)
  2. cd repro1
  3. edit src/main.js
  import Vue from 'vue'
  import App from './App.vue'

  Vue.config.productionTip = false

+ function loader (path) {
+   return () => import(path)
+ }

  new Vue({
    render: h => h(App),
  }).$mount('#app')
  1. vue add vuex

What is expected?

vuex should be possible install.

What is actually happening?

esprima error occurred as following.

🚀  Invoking generator for core:vuex...
(node:31993) UnhandledPromiseRejectionWarning: Error: Line 7: Unexpected reserved word
    at ErrorHandler.constructError (/Users/kazupon/.enviroments/bin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:5012:22)
    at ErrorHandler.createError (/Users/kazupon/.enviroments/bin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:5028:27)
    at Parser.unexpectedTokenError (/Users/kazupon/.enviroments/bin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:1985:39)
    at Parser.throwUnexpectedToken (/Users/kazupon/.enviroments/bin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:1995:21)
    at Parser.parsePrimaryExpression (/Users/kazupon/.enviroments/bin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:2390:38)
    at Parser.inheritCoverGrammar (/Users/kazupon/.enviroments/bin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:2285:37)
    at Parser.parseLeftHandSideExpressionAllowCall (/Users/kazupon/.enviroments/bin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:2899:26)
    at Parser.inheritCoverGrammar (/Users/kazupon/.enviroments/bin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:2285:37)
    at Parser.parseUpdateExpression (/Users/kazupon/.enviroments/bin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:3004:26)
    at Parser.parseUnaryExpression (/Users/kazupon/.enviroments/bin/.nvm/versions/node/v11.6.0/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:3048:26)
(node:31993) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:31993) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

The same issue occurs with vue add router as well.

Related issues
intlify/vue-cli-plugin-i18n#32

We should be added notice to documentation, due to I think main.(js|ts) should not be edited by user.

@LinusBorg
Copy link
Member

LinusBorg commented Jan 15, 2019

That's probably because Esprima only supports ES6, and dynamic imports are still a stage 3 proposal.

In other words: users could safely edit main.js as long as they don't use dynamic imports.

Not as bad, but bad enough. :/

@lbogdan
Copy link
Contributor

lbogdan commented Jan 20, 2019

(Maybe) related: #3335 .

@LinusBorg
Copy link
Member

LinusBorg commented Jan 21, 2019

@lbogdan I think that issue is unrelated.

Esprima shouldn't be involved in the webpack compilation. Also that error is fixed by installing with yarn instead of npm, which means with npm we have some dependency resolving mismatch.

@gwvt
Copy link

gwvt commented Feb 9, 2021

I encountered this error adding the vue-i18n plugin to an existing project in which src/main.js had been edited. I reverted the file to the vue-cli boilerplate, but the error persisted. Creating a new, clean project and adding the plugin worked correctly.

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

Successfully merging a pull request may close this issue.

4 participants