【发布时间】:2016-04-20 09:16:57
【问题描述】:
我正在将一个 ES2015 node.js 应用程序从 Heroku 迁移到 Azure。
当前在 Heroku 上运行的启动命令是
"start": "./node_modules/babel-cli/bin/babel-node.js index.js"
但是,在 Azure 上我得到了
package.json 中的启动命令“./node_modules/babel-cli/bin/babel-node.js index.js”无效。请使用“节点”格式。
这表示 Azure 仅支持 npm start 的 vanilla 节点。
我知道在生产环境中运行 babel-node 并不理想,但我希望能够直接进行迁移。
需要重新架构的三个选项是:
- 使用 gulp 工作流预编译 ES2015:https://github.com/christopheranderson/azure-node-es2015-example
- 使用 bash 工作流预编译 ES2015:http://www.wintellect.com/devcenter/dbaskin/deploying-an-es6-jspm-nodejs-application-to-azure
- 使用
babel-registerala [cmets 中的链接]。
我怀疑选项 3 最简单,但检查是否有人遇到类似问题并设法在 Azure 上直接在 npm start 中运行 babel-node。
【问题讨论】:
-
babel-register 参考:shellmonger.com/2016/01/08/…
标签: node.js azure npm ecmascript-6 babeljs