I am migrating an ES2015 node.js application from Heroku to Azure.
The current start-up command running on Heroku is
"start": "./node_modules/babel-cli/bin/babel-node.js index.js"
However, on Azure I am getting
Invalid start-up command "./node_modules/babel-cli/bin/babel-node.js index.js" in package.json. Please use the format "node <script relative path>".
Which indicates that Azure only supports vanilla node for npm start
.
I'm aware that running babel-node on production isn't ideal, but I was hoping for a straightforward migration.
Three options that would require a bit of re-architecting are:
babel-register
ala [link in comments].I suspect option 3 will be easiest but checking if anyone has come across a similar issue and managed to run babel-node
directly in npm start
on Azure.
According your issue, please modify your start
npm script to node ./node_modules/babel-cli/bin/babel-node.js index.js
on Azure Web Apps.
Here is the content in test package.json
:
{
"name": "website",
"description": "A basic website",
"version": "1.0.0",
"engines": {
"node": "5.9.1",
"npm": "3.7.3"
},
"scripts": {
"start": "node ./node_modules/babel-cli/bin/babel-node.js index.js"
},
"dependencies": {
"babel-preset-es2015": "^6.6.0",
"babel-cli": "^6.0.0"
}
}
Meanwhile if you need a higher Node.js version, you can specify in package.json
, refer to https://azure.microsoft.com/en-us/documentation/articles/nodejs-specify-node-version-azure-apps/ for more.
Just as what Gary said, you need to update your package.json
using the command below.
"scripts": {
"start": "node ./node_modules/babel-cli/bin/babel-node.js index.js"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With