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

Unexpected token import for nodejs on GAE Flex #478

Closed
alanma opened this issue Sep 12, 2017 · 2 comments
Closed

Unexpected token import for nodejs on GAE Flex #478

alanma opened this issue Sep 12, 2017 · 2 comments
Labels
🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@alanma
Copy link

alanma commented Sep 12, 2017

I deployed a nodejs app on appengine flexible today. But the deployed server won't start with the following error in the logs. I'm confused why my import statement is being marked as errors. Please help! Thanks in advance.

A  /app/src/server/index.js:2
 
A  import gqlServer from './myServer';
 
A  SyntaxError: Unexpected token import
    at createScript (vm.js:53:10)
    at Object.runInThisContext (vm.js:95:10)
    at Module._compile (module.js:543:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:423:7)
    at startup (bootstrap_node.js:147:9)
 
  undefined

@jmdobry
Copy link
Member

jmdobry commented Sep 19, 2017

The import keyword is only supported in the newest Node v8.5.0 I believe, and even then, behind a flag. You'll need to set your engines field in package.json to >=8.5.0 and your start script to node --experimental-modules src/server/index.js. And, I believe your index.js actually needs to be index.mjs. See http://2ality.com/2017/09/native-esm-node.html

@JustinBeckwith
Copy link
Contributor

Greetings! This issue has been hanging out for a while. If you're still running into issues... please do let us know! We're going to close this one out for now.

@yoshi-automation yoshi-automation added 🚨 This issue needs some love. triage me I really want to be triaged. labels Apr 7, 2020
telpirion pushed a commit that referenced this issue Nov 16, 2022
* updated CHANGELOG.md [ci skip]

* updated package.json [ci skip]

* updated samples/package.json [ci skip]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

4 participants