intlify / vue-cli-plugin-i18n

:globe_with_meridians: Vue CLI plugin to add vue-i18n to your Vue Project
MIT License
195 stars 41 forks source link

"Error: Line 15: Unexpected token :" when invoking plugin #19

Open SolarLiner opened 6 years ago

SolarLiner commented 6 years ago

While invoking the plugin (both from the UI and through vue invoke), with defaults kept as is, the Vue CLI crashes with the following stacktrace:

Error: Line 15: Unexpected token :
    at ErrorHandler.constructError (/home/solarliner/.nvm/versions/node/v10.9.0/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:5012:22)
    at ErrorHandler.createError (/home/solarliner/.nvm/versions/node/v10.9.0/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:5028:27)
    at Parser.unexpectedTokenError (/home/solarliner/.nvm/versions/node/v10.9.0/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:1985:39)
    at Parser.throwUnexpectedToken (/home/solarliner/.nvm/versions/node/v10.9.0/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:1995:21)
    at Parser.expect (/home/solarliner/.nvm/versions/node/v10.9.0/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:2168:19)
    at Parser.parseGroupExpression (/home/solarliner/.nvm/versions/node/v10.9.0/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:2764:27)
    at Parser.inheritCoverGrammar (/home/solarliner/.nvm/versions/node/v10.9.0/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:2285:37)
    at Parser.parsePrimaryExpression (/home/solarliner/.nvm/versions/node/v10.9.0/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:2348:38)
    at Parser.inheritCoverGrammar (/home/solarliner/.nvm/versions/node/v10.9.0/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:2285:37)
    at Parser.parseLeftHandSideExpressionAllowCall (/home/solarliner/.nvm/versions/node/v10.9.0/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:2899:26)
razorfever commented 6 years ago

Having the same problem. In my case it's line 41 though:

Invoking generator for vue-cli-plugin-i18n... ERROR Error: Line 41: Unexpected token ... Error: Line 41: Unexpected token ... at ErrorHandler.constructError (/Users/razorfever/.config/yarn/global/node_modules/esprima/dist/esprima.js:5004:22) at ErrorHandler.createError (/Users/razorfever/.config/yarn/global/node_modules/esprima/dist/esprima.js:5020:27) at Parser.unexpectedTokenError (/Users/razorfever/.config/yarn/global/node_modules/esprima/dist/esprima.js:1985:39) at Parser.throwUnexpectedToken (/Users/razorfever/.config/yarn/global/node_modules/esprima/dist/esprima.js:1995:21) at Parser.parseObjectPropertyKey (/Users/razorfever/.config/yarn/global/node_modules/esprima/dist/esprima.js:2492:33) at Parser.parseObjectProperty (/Users/razorfever/.config/yarn/global/node_modules/esprima/dist/esprima.js:2527:25) at Parser.parseObjectInitializer (/Users/razorfever/.config/yarn/global/node_modules/esprima/dist/esprima.js:2595:35) at Parser.inheritCoverGrammar (/Users/razorfever/.config/yarn/global/node_modules/esprima/dist/esprima.js:2278:37) at Parser.parsePrimaryExpression (/Users/razorfever/.config/yarn/global/node_modules/esprima/dist/esprima.js:2347:38) at Parser.inheritCoverGrammar (/Users/razorfever/.config/yarn/global/node_modules/esprima/dist/esprima.js:2278:37)

kazupon commented 6 years ago

Could you provide minimum repro repo please?

hjJunior commented 5 years ago

Same problem here, running with vue ui when I add the plugin and done the setup I got this error. I've tested this on node 8.11.3 (npm 5.6.0) and v10.11.0 (npm v6.4.1)

    at ErrorHandler.createError (/home/helio/.nvm/versions/node/v8.11.3/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:5028:27)
    at Parser.unexpectedTokenError (/home/helio/.nvm/versions/node/v8.11.3/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:1985:39)
    at Parser.throwUnexpectedToken (/home/helio/.nvm/versions/node/v8.11.3/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:1995:21)
    at Parser.parseObjectPropertyKey (/home/helio/.nvm/versions/node/v8.11.3/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:2499:33)
    at Parser.parseObjectProperty (/home/helio/.nvm/versions/node/v8.11.3/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:2534:25)
    at Parser.parseObjectInitializer (/home/helio/.nvm/versions/node/v8.11.3/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:2602:35)
    at Parser.inheritCoverGrammar (/home/helio/.nvm/versions/node/v8.11.3/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:2285:37)
    at Parser.parsePrimaryExpression (/home/helio/.nvm/versions/node/v8.11.3/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:2354:38)
    at Parser.inheritCoverGrammar (/home/helio/.nvm/versions/node/v8.11.3/lib/node_modules/@vue/cli/node_modules/esprima/dist/esprima.js:2285:37)
yoyoys commented 5 years ago

It's a typescript syntax error, an easy workaround here: just comment declare section and installation works fine.

nawordar commented 3 years ago

Would it be possible to show the file where the error occurred? It would make debugging a lot easier.