i5ting / koa-generator

Koa' application generator for 1.x and 2.x( Express-style and support all middlewares include async/await )
https://github.com/17koa/koa-generator
MIT License
975 stars 110 forks source link

can not run app generated by koa2 #25

Closed AubreyHewes closed 7 years ago

AubreyHewes commented 8 years ago

I tried

koa2 --hbs --css sass --git koa2-test

Install works fine https://gist.githubusercontent.com/AubreyHewes/fa6881ecd9089482ccc5a26f0ad2e126/raw

Running npm start works fine https://gist.githubusercontent.com/AubreyHewes/3498e3ec955cf04ced5cf09e32865b22/raw

Running npm run koa fails... https://gist.githubusercontent.com/AubreyHewes/20f64418bf61213078ad171296a9ee59/raw

So I installed the failing module babel-plugin-add-module-exports.. then it fails on babel-plugin-transform-es2015-modules-commonjs.. https://gist.githubusercontent.com/AubreyHewes/972d7b3c031d8a59bff1f34dad94e387/raw

So I installed the failing module babel-plugin-transform-es2015-modules-commonjs .. it still fails on the same module babel-plugin-transform-es2015-modules-commonjs.. https://gist.githubusercontent.com/AubreyHewes/b5bee5ee974c10fbe2f7c3e26d1845d7/raw

I assume it's just not ready for what I tried.. I looked into it a little and koa-views does not seem to support handlebars layouts..

Linux 4.2.0-36-generic #42-Ubuntu SMP Thu May 12 22:05:35 UTC 2016 x86_64 x86_64
node: v5.12.0
npm: 3.8.6

Any tips appreciated, thanks.

sinalvee commented 8 years ago

When using as runkoa xxx, runkoa consider it is in CLI. So it try to find packages in node_modules. But koa-generator use runkoa as ./node_modules/.bin/runkoa ,there is no node_modules under node_modules if npm's version >= 3. That's why it gets error.

It's a bug of runkoa, or we can say it's an incorrect usage of runkoa. In a word, one of them need to be fixed.

@i5ting 桑大有空改一下吧,哈哈哈