Vue-cli: Error adding plugin pwa

Created on 19 Nov 2019  Â·  3Comments  Â·  Source: vuejs/vue-cli

Version

4.0.5

Reproduction link

not available now

Environment info


PS Z:\website\innenu-website> vue info

Environment Info:

  System:
    OS: Windows 10
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz 
  Binaries:
    Node: 12.13.0 - C:\Program Files\nodejs\node.EXE       
    Yarn: 1.19.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.13.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 44.18362.449.0
  npmPackages:
    @ant-design/icons-vue:  2.0.0
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0
    @vue/babel-plugin-transform-vue-jsx:  1.1.2
    @vue/babel-preset-app:  4.0.5
    @vue/babel-preset-jsx:  1.1.2
    @vue/babel-sugar-functional-vue:  1.1.2
    @vue/babel-sugar-inject-h:  1.1.2
    @vue/babel-sugar-v-model:  1.1.2
    @vue/babel-sugar-v-on:  1.1.2
    @vue/cli-overlay:  4.0.5
    @vue/cli-plugin-babel: ^4.0.5 => 4.0.5
    @vue/cli-plugin-e2e-cypress: ^4.0.5 => 4.0.5
    @vue/cli-plugin-eslint: ^4.0.5 => 4.0.5
    @vue/cli-plugin-pwa: ^4.0.5 => 4.0.5
    @vue/cli-plugin-router: ^4.0.5 => 4.0.5
    @vue/cli-plugin-typescript: ^4.0.5 => 4.0.5
    @vue/cli-plugin-unit-mocha: ^4.0.5 => 4.0.5
    @vue/cli-plugin-vuex: ^4.0.5 => 4.0.5
    @vue/cli-service: ^4.0.5 => 4.0.5
    @vue/cli-shared-utils:  4.0.5
    @vue/component-compiler-utils:  3.0.2
    @vue/eslint-config-prettier: ^6.0.0 => 6.0.0
    @vue/eslint-config-typescript: ^5.0.0 => 5.0.0
    @vue/preload-webpack-plugin:  1.1.1
    @vue/test-utils: 1.0.0-beta.29 => 1.0.0-beta.29
    @vue/web-component-wrapper:  1.2.0
    ant-design-vue: ^1.4.5 => 1.4.5
    babel-helper-vue-jsx-merge-props:  2.0.3
    eslint-plugin-vue: ^6.0.1 => 6.0.1
    svg-to-vue:  0.6.0
    typescript: ^3.7.2 => 3.7.2
    vue: ^2.6.10 => 2.6.10
    vue-class-component: ^7.1.0 => 7.1.0
    vue-eslint-parser:  6.0.5
    vue-hot-reload-api:  2.3.4
    vue-loader:  15.7.2
    vue-property-decorator: ^8.3.0 => 8.3.0
    vue-ref:  1.0.6
    vue-router: ^3.1.3 => 3.1.3
    vue-style-loader:  4.1.2
    vue-svg-loader: ^0.15.0 => 0.15.0
    vue-template-compiler: ^2.6.10 => 2.6.10
    vue-template-es2015-compiler:  1.9.1
    vue-wechat-title: ^2.0.5 => 2.0.5
    vuex: ^3.1.2 => 3.1.2
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

PS Z:\website\innenu-website> vue add pwa

�📦  Installing @vue/cli-plugin-pwa...

yarn add v1.19.1
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved 1 new dependency.
info Direct dependencies
└─ @vue/[email protected]
info All dependencies
└─ @vue/[email protected]
Done in 17.38s.
✔  Successfully installed plugin: @vue/cli-plugin-pwa

�🚀  Invoking generator for @vue/cli-plugin-pwa...
 ERROR  SyntaxError: Unexpected token, expected "," (123:20)
SyntaxError: Unexpected token, expected "," (123:20)
    at Object.raise (C:\Users\zhang\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\@babel\parser\lib\index.js:6420:17)
    at Object.unexpected (C:\Users\zhang\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\@babel\parser\lib\index.js:7773:16)
    at Object.expect (C:\Users\zhang\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\@babel\parser\lib\index.js:7759:28)
    at Object.parseParenAndDistinguishExpression (C:\Users\zhang\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\@babel\parser\lib\index.js:9117:14)
    at Object.parseExprAtom (C:\Users\zhang\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\@babel\parser\lib\index.js:465:22)
    at Object.parseExprAtom (C:\Users\zhang\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\@babel\parser\lib\index.js:3618:20)
    at Object.parseExprSubscripts (C:\Users\zhang\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\@babel\parser\lib\index.js:8556:23)      
    at Object.parseMaybeUnary (C:\Users\zhang\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\@babel\parser\lib\index.js:8536:21)
    at Object.parseExprOps (C:\Users\zhang\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\@babel\parser\lib\index.js:8402:23)

What is expected?

No error

What is actually happening?

Can not add pwa

bug

Most helpful comment

Workaround: remove TS syntax in main.ts, run vue add pwa, and then manually add the TS code back.

All 3 comments

Seems the generator failed to parse the TS syntax in main.ts.
Should be considered a bug.

Workaround: remove TS syntax in main.ts, run vue add pwa, and then manually add the TS code back.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings