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:
npm run babel-node --presets env app.js
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…