How to run koa with nodejs v6.11.2
See original GitHub issueNodejs version 6.11.2 is LTS.So I need to use this nodejs version to run koa2.I followed tutorial and code is:
require('babel-register');
const Koa = require('koa');
const app = new Koa();
app.use(async ctx => {
ctx.body = 'Hello World';
});
app.listen(3000);
Package.json:
{
"name": "koa",
"version": "1.0.0",
"description": "",
"main": "app.js",
"dependencies": {
"babel-cli": "^6.24.1",
"babel-plugin-transform-async-to-module-method": "6.24.1",
"babel-register": "6.24.1",
"koa": "2.3.0"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
But it didn’t say how to run app.js?
I try node app.js
and it did not work.
Any helps?
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
How To Build a "Hello World" Application with Koa
Node.js installed locally, which you can do by following How to Install Node.js and Create a Local Development Environment.
Read more >Koa - next generation web framework for node.js
Koa requires node v12 or higher for ES2015 and async function support. You can quickly install a supported version of node with your...
Read more >Node.js Notes for Professionals | IERTEC
Section 1.4: Installing and Running Node.js. 6 ... Section 11.2: Get the names of the events that are subscribed to ... Chapter 61:...
Read more >Online Node.js Compiler - Tutorialspoint
11.2) helps you to Edit, Run and Share your Node Code directly from your browser. This development environment provides you version Node v6.11.2....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This works for me.
index.js
app.js
.babelrc
package.json
You can compile project with webpack to
server.js
and then compile it again with preset with target tonode 6.11.2
Sorry, I don’t have time to make a simple clear solution, but you can try do digg code: https://github.com/hastic/hastic-server/blob/9000adefcc79e48e45089f9d25960f7805a37e48/server/package.json
Also I can’t say that it is the BEST solution, but it works.