Giter Club home page Giter Club logo

Comments (3)

terkelg avatar terkelg commented on May 12, 2024

async/await is available in Node v7.6 and above. Prompts only use the transpiled version if needed.

The example file is just for demonstration purpose only and not being transpiled. It's easy to convert to promises though.

from prompts.

bnb avatar bnb commented on May 12, 2024

Ah, gotcha. Apologies for my unfamiliarity with async/await and promises.

I suppose I assumed this was caused by trying to copy/paste the example into a file called cli.js (plus changing const { prompt } = require('./'); to require the module) and running cli.js.

Suppose I'm doing something wrong, and don't necessarily expect support – mostly just curious what I am doing wrong if there is something 😅

/Users/tierney/GitHub/ncm-cli/cli.js:5
(async function(){
       ^^^^^^^^
SyntaxError: Unexpected token function
    at Object.exports.runInThisContext (vm.js:76:16)
    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.runMain (module.js:604:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

from prompts.

terkelg avatar terkelg commented on May 12, 2024

You have to remove async/await if you're node version is below 8. In that case you don't need the outer async function. Make sure to make the await call a promise too.

from prompts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.