我有一个从express-mongoose-es6-rest-api存储库构建的应用程序,并希望部署到Heroku。部署结束时会出现以下错误。
2017-03-14T19:38:34.000000+00:00 app[api]: Build started by user ibnclaudius@gmail.com
2017-03-14T19:39:19.965665+00:00 heroku[web.1]: State changed from crashed to starting
2017-03-14T19:39:19.699021+00:00 app[api]: Deploy fe861f2 by user ibnclaudius@gmail.com
2017-03-14T19:39:19.699021+00:00 app[api]: Release v10 created by user ibnclaudius@gmail.com
2017-03-14T19:39:19.901838+00:00 app[api]: Release v10 created by user ibnclaudius@gmail.com
2017-03-14T19:38:34.000000+00:00 app[api]: Build succeeded
2017-03-14T19:39:23.151513+00:00 heroku[web.1]: Starting process with command `npm start`
2017-03-14T19:39:25.291685+00:00 app[web.1]:
2017-03-14T19:39:25.291701+00:00 app[web.1]: > express-mongoose-es6-rest-api@2.0.0 start /app
2017-03-14T19:39:25.291702+00:00 app[web.1]: > gulp serve
2017-03-14T19:39:25.291703+00:00 app[web.1]:
2017-03-14T19:39:25.989393+00:00 app[web.1]: [19:39:25] Requiring external module babel-register
2017-03-14T19:39:26.010238+00:00 app[web.1]: /app/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180
2017-03-14T19:39:26.010243+00:00 app[web.1]: throw new ReferenceError(messages.get("pluginUnknown", plugin, loc, i, dirname));
2017-03-14T19:39:26.010244+00:00 app[web.1]: ^
2017-03-14T19:39:26.010245+00:00 app[web.1]:
2017-03-14T19:39:26.010246+00:00 app[web.1]: ReferenceError: Unknown plugin "add-module-exports" specified in "/app/package.json" at 0, attempted to resolve relative to "/app"
2017-03-14T19:39:26.010247+00:00 app[web.1]: at /app/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:17
2017-03-14T19:39:26.010248+00:00 app[web.1]: at Array.map (native)
2017-03-14T19:39:26.010250+00:00 app[web.1]: at Function.normalisePlugins (/app/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
2017-03-14T19:39:26.010251+00:00 app[web.1]: at OptionManager.mergeOptions (/app/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:233:36)
2017-03-14T19:39:26.010251+00:00 app[web.1]: at OptionManager.init (/app/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:367:12)
2017-03-14T19:39:26.010252+00:00 app[web.1]: at compile (/app/node_modules/babel-register/lib/node.js:103:45)
2017-03-14T19:39:26.010253+00:00 app[web.1]: at loader (/app/node_modules/babel-register/lib/node.js:144:14)
2017-03-14T19:39:26.010253+00:00 app[web.1]: at Object.require.extensions.(anonymous function) [as .js] (/app/node_modules/babel-register/lib/node.js:154:7)
2017-03-14T19:39:26.010254+00:00 app[web.1]: at Module.load (module.js:488:32)
2017-03-14T19:39:26.010255+00:00 app[web.1]: at tryModuleLoad (module.js:447:12)
2017-03-14T19:39:26.025164+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2017-03-14T19:39:26.025506+00:00 app[web.1]: npm ERR! errno 1
2017-03-14T19:39:26.025672+00:00 app[web.1]: npm ERR! express-mongoose-es6-rest-api@2.0.0 start: `gulp serve`
2017-03-14T19:39:26.025795+00:00 app[web.1]: npm ERR! Exit status 1
2017-03-14T19:39:26.025939+00:00 app[web.1]: npm ERR!
2017-03-14T19:39:26.026058+00:00 app[web.1]: npm ERR! Failed at the express-mongoose-es6-rest-api@2.0.0 start script 'gulp serve'.
2017-03-14T19:39:26.026176+00:00 app[web.1]: npm ERR! Make sure you have the latest version of node.js and npm installed.
2017-03-14T19:39:26.026297+00:00 app[web.1]: npm ERR! If you do, this is most likely a problem with the express-mongoose-es6-rest-api package,
2017-03-14T19:39:26.026407+00:00 app[web.1]: npm ERR! not with npm itself.
2017-03-14T19:39:26.026530+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2017-03-14T19:39:26.026645+00:00 app[web.1]: npm ERR! gulp serve
2017-03-14T19:39:26.026763+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2017-03-14T19:39:26.026893+00:00 app[web.1]: npm ERR! npm bugs express-mongoose-es6-rest-api
2017-03-14T19:39:26.027008+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2017-03-14T19:39:26.027125+00:00 app[web.1]: npm ERR! npm owner ls express-mongoose-es6-rest-api
2017-03-14T19:39:26.027240+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2017-03-14T19:39:26.028139+00:00 app[web.1]:
2017-03-14T19:39:26.028315+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2017-03-14T19:39:26.028455+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2017-03-14T19_39_26_022Z-debug.log
2017-03-14T19:39:26.107162+00:00 heroku[web.1]: Process exited with status 1
我不知道我需要在项目中使用哪个设置才能工作。我做错了什么?
答案 0 :(得分:1)
基于提供的信息,我猜测是因为babel-plugin-add-module-exports
被添加为dev依赖项。或者至少是original repo中的情况。官方nodejs buildpack不安装dev依赖项。为此,您需要将NPM_CONFIG_PRODUCTION
设置为false
。您可以使用此命令
heroku config:set NPM_CONFIG_PRODUCTION=false
然后再次部署。或者,您可以将此模块移动到常规依赖项,但我猜其他内容仍然会导致问题。