Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm start not working locally #19

Open
paulmiller3000 opened this issue Dec 16, 2019 · 2 comments
Open

npm start not working locally #19

paulmiller3000 opened this issue Dec 16, 2019 · 2 comments

Comments

@paulmiller3000
Copy link

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 start

my-app@1.0.0 start C:\source\my-app
per-env

Miller@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?

@siburny
Copy link

siburny commented Mar 20, 2021

It turns out spawnSync must be started with shell: true option.

Update: more info here nodejs/node#3675 (comment)

@HitoriSensei
Copy link

HitoriSensei commented Jun 27, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants