Skip to content
This repository was archived by the owner on Feb 7, 2020. It is now read-only.

Error when running awsmobile init #77

Closed
jerwallace opened this issue Mar 17, 2018 · 7 comments
Closed

Error when running awsmobile init #77

jerwallace opened this issue Mar 17, 2018 · 7 comments
Labels

Comments

@jerwallace
Copy link

Was following the guide here:
https://docs.aws.amazon.com/aws-mobile/latest/developerguide/web-getting-started.html

Created a sample app:
https://reactjs.org/blog/2016/07/22/create-apps-with-no-configuration.html

Then ran the init line:
awsmobile init <ID_HERE>

The following response was given:

/usr/local/lib/node_modules/awsmobile-cli/lib/init-steps/s2-choose-strategy.js:104
async function inquirerForValid(initInfo){
      ^^^^^^^^
SyntaxError: Unexpected token function
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/awsmobile-cli/lib/command-init.js:16:24)
@Gribbs
Copy link

Gribbs commented Mar 17, 2018

You sure it’s not your Node version? I just had the same error trying to run code using async/await on Lambda. The Nodejs runtime was too old on Lambda for async functions. If using Mac, try:
brew update
brew upgrade node

@m-bymike
Copy link
Contributor

Hi @jerwallace ,
you probably had the same issue as I did. I proposed a fix in #78 . Until it's accepted and released, you can clone my fork, run npm install and runt the command directly from the local repo path/to/repo/bin/awsmobile init...

@UnleashedMind
Copy link
Contributor

This is a bug
@m-bymike Thanks for the contribution, your pull request has been merged.
The bug fix has been published to the latest version v1.0.21

@UnleashedMind
Copy link
Contributor

close this issue for now, feel free to re-open it if you still see the same problem

@kravenoff42
Copy link

Just ran into the exact same issue

ec2-user:~/environment/portfolio $ awsmobile init [project ID]                                                                                                                           

/home/ec2-user/.nvm/versions/node/v6.13.0/lib/node_modules/awsmobile-cli/lib/init-steps/s2-choose-strategy.js:104
async function inquirerForValid(initInfo){
      ^^^^^^^^

SyntaxError: Unexpected token function
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:549:28)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.require (module.js:504:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/ec2-user/.nvm/versions/node/v6.13.0/lib/node_modules/awsmobile-cli/lib/command-init.js:16:24)

Here are the versions I've got:

npm v3.10.10
Node v6.13.0
create-react-app v1.5.2
awsmobile-cli 1.0.21

let me know if there any other info I can get you to help

@UnleashedMind
Copy link
Contributor

We obviously mixed two issues here.
One issue is a bug that has already been fix by the latest release v1.0.21
The other issue is because the node version is too old, and it does not support the async/await syntax. We suggest to use node version 8 and above.

@luisdoesdev
Copy link

luisdoesdev commented May 3, 2018

I used the latest version of Node and I still ran into the problem 😞

EDIT: Okay, using sudo awsmobile init did the trick.

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

No branches or pull requests

6 participants