npm start not working locally
paulmiller3000 opened this issue · 2 comments
I may be missing something obvious, but npm start
does not launch my app. Instead, it drops me back to the terminal prompt. My output looks like this:
Miller@Miller-Laptop-P MINGW64 /c/source/my-app (development)
$ npm startmy-app@1.0.0 start C:\source\my-app
per-envMiller@Miller-Laptop-P MINGW64 /c/source/my-app (development)
$
Here's my package.json:
{
"name": "my-app",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "per-env",
"start:development" : "node -r dotenv/config server.js",
"start:staging" : "node server.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^0.19.0",
"bcryptjs": "^2.4.3",
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"db-migrate": "^0.11.6",
"db-migrate-pg": "^1.0.0",
"express": "^4.17.1",
"knex": "^0.20.4",
"nodemon": "^2.0.2",
"per-env": "^1.0.2",
"pg": "^7.14.0"
},
"devDependencies": {
"dotenv": "^8.2.0"
}
}
I'm running Windows, so just for fun I created a system environment variable named NODE_ENV and set it to "development."
What am I missing?
It turns out spawnSync
must be started with shell: true
option.
Update: more info here nodejs/node#3675 (comment)
Since using shell: true
has more severe implications that just "making it work", I've used which
package to find a location of the npm
command