Comments (3)
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.
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.
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)
- Shift + Enter should not trigger submit for text input
- Confirm dialog appends yes message when aborted HOT 2
- Consider including TypeScript declaration files HOT 1
- How to test prompts in CircleCI?
- Select crashing in VsCode + Git Bash: Cannot read properties of undefined (reading 'split') HOT 2
- Multi-option toggle. Worth it?
- Ensure types are exported HOT 3
- How to cancel these unnecessary logs HOT 5
- logic diagram
- Ast prompts
- Roadmap for a 3.0 HOT 5
- prompts captures Ctrl-W "cut word" shortcut as control character
- How to make autocomplete required or select searchable?
- Add mask option to Text Type
- Somewhat different published module than the one in the repo HOT 2
- Keypress events may not be triggered on Windows if validate callback contains async actions HOT 2
- Bun support HOT 10
- confirm element: pressing a function key throws an error
- correctly type return/resolved values instead of `any`
- Initial value not passed to validate function for `"number"` types
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prompts.