My package.json looks like:
{
"name": "99-nodetest",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1",
"start": "babel-node --presets env app.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"babel-cli": "^6.26.0",
"babel-preset-env": "latest"
}
}
The js script i want to run is app.js. I cannot run it directly using node app.js because app.js contains new language syntax.
Thus i have to run it through babel, using npm start, as per the start script defined above. No issues here.
My question is how to run the cmd directly in the command line, can it be done? something similar to:
See Question&Answers more detail:osnpm run babel-node --presets env app.js