Skip to content
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

Google Response Code 400: SyntaxError: Cannot use import statement outside a module line: 1 file: src/main.gs' #1

Closed
RCRJ opened this issue Jun 6, 2020 · 2 comments
Labels
question Further information is requested

Comments

@RCRJ
Copy link

RCRJ commented Jun 6, 2020

Hi, I have a lot of experience with GAS and clasp however this is my first attempt to use Vue so this tool could really be a lifesaver from me. I hope I am not simply using the tool incorrectly.

I'm attempting to deploy a blank project before I actually start developing and have gotten to the point that I'm trying to run npm run deploy however it seems Google has an issue with src/main.js.


Error: (starting after the request body)

"responseType: 'json',
retryConfig: {
currentRetryAttempt: 0,
retry: 3,
httpMethodsToRetry: [Array],
noResponseRetries: 2,
statusCodesToRetry: [Array]
}
},
code: 400,
errors: [
{
message: 'Syntax error: SyntaxError: Cannot use import statement outside a module line: 1 file: src/main.gs',
domain: 'global',
reason: 'badRequest'
}
]
}
└─ Code.js
└─ appsscript.json
└─ babel.config.js
└─ dist/ErrorHandler.gs
└─ dist/Service.gs
└─ dist/index.html
└─ public/index.html
└─ src/main.js
└─ src/plugins/vuetify.js
└─ src/server/ErrorHandler.js
└─ src/server/Service.js
└─ vue.config.js
Updating project version...

Created version 2. (we can see here that the deploy is updating the version, however it is not actually pushing these files to my Google Drive)

  • xxxxxxx @2."

The code in main.js hasn't been edited in any way:

import google from '@ijusplab/vue-cli-plugin-gas/google.mock';
import VueGasPlugin from '@ijusplab/vue-cli-plugin-gas/utils/VueGasPlugin';
import Vue from 'vue';
import App from './App.vue';
import vuetify from './plugins/vuetify';

Vue.config.productionTip = false;

Vue.use(VueGasPlugin, {
  google,
  devMode: process.env.NODE_ENV !== 'production',
});

new Vue({
  vuetify,
  render: (h) => h(App),
}).$mount('#app');
@cmlima cmlima added bug Something isn't working question Further information is requested and removed bug Something isn't working labels Jun 6, 2020
@cmlima
Copy link
Contributor

cmlima commented Jun 6, 2020

Hi, @RCRJ ,

Unfortunately, I wasn't able to reproduce your issue. I just created a new project, chose the standalone option and executed npm deploy run successfully. After publishing my code as a web app, I was also able to render the default Vue app by following the latest code hyperlink.

Would you provide some more info so that I can reproduce your issue? Are you running Vue CLI on windows or linux? What kind of script are you trying to create? Did you see any error messages during scaffold process? Did you follow the instructions in README?

As per the error message reproduced in your message, I am guessing either the build process was bypassed or .clasp.json was not configured correctly (it should have the "rootDir" parameter set to "./dist", so as to assure that only files from the dist folder will be deployed).

@RCRJ
Copy link
Author

RCRJ commented Jun 6, 2020

@cmlima I really appreciate you taking the time to explain that, defining the rootDir as ./dist fixed the issue and I don't see any errors. Also thank you for creating this tool!

@RCRJ RCRJ closed this as completed Jun 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants