17koa / runkoa

DEPRECATED runkoa:使用koa1和koa2的时候,不用在意babel的细节,无论哪种写法(common, generator, async)都完美支持
https://github.com/17koa/runkoa
MIT License
100 stars 15 forks source link

pluginUnknown错误 #17

Closed baryon closed 7 years ago

baryon commented 7 years ago

使用koa-generator生成一个项目,运行时出pluginUnknown的错误,node版本6.9.1 如果使用node7,是没有问题的。

$ nvm use 6.9.1
Now using node v6.9.1 (npm v4.0.3)
$ DEBUG=HelloKoa2:* npm start pm2

> HelloKoa2@0.1.0 start /HelloKoa2
> nodemon bin/run "pm2"

[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node bin/run pm2`
3babel presets path = /HelloKoa2/node_modules/runkoa/node_modules
/HelloKoa2/node_modules/babel-core/lib/transformation/file/options/option-manager.js:176
          throw new ReferenceError(messages.get("pluginUnknown", plugin, loc, i, dirname));
          ^

ReferenceError: Unknown plugin "/HelloKoa2/node_modules/runkoa/node_modules/babel-plugin-add-module-exports" specified in "base" at 0, attempted to resolve relative to "/HelloKoa2/bin"
    at/Works/HelloKoa2/node_modules/babel-core/lib/transformation/file/options/option-manager.js:176:17
    at Array.map (native)
    at Function.normalisePlugins (/HelloKoa2/node_modules/babel-core/lib/transformation/file/options/option-manager.js:154:20)
    at OptionManager.mergeOptions (/HelloKoa2/node_modules/babel-core/lib/transformation/file/options/option-manager.js:229:36)
    at OptionManager.init (/HelloKoa2/node_modules/babel-core/lib/transformation/file/options/option-manager.js:374:12)
    at compile (/HelloKoa2/node_modules/babel-register/lib/node.js:103:45)
    at loader (/HelloKoa2/node_modules/babel-register/lib/node.js:144:14)
    at Object.require.extensions.(anonymous function) [as .js] (/HelloKoa2/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
[nodemon] app crashed - waiting for file changes before starting...
baryon commented 7 years ago

npm4.0以上的版本会发生这个问题, 只需要修改一个地方就好

i5ting commented 7 years ago

感谢

i5ting commented 7 years ago