2

My package.json file for the server folder I'm trying to start:

{
  "name": "server",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "nodemon src/app.js --exec 'npm run lint && node'",
    "lint": "./node_modules/.bin/eslint **/*.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "eslint": "^4.12.0",
    "nodemon": "^1.12.1"
  }
}

I do not know why it doesn't notice npm from the package.json start script when npm runs perfectly when it's not being executed through package.json.

Anyone know why? I'm trying to learn Full Stack development and I am confused on this error.

Edit: I'm running Windows 10.

5
  • What OS are you running on? Commented Nov 27, 2017 at 5:30
  • Windows 10 is my OS Commented Nov 27, 2017 at 5:45
  • what does npm -v gives?? Commented Nov 27, 2017 at 6:07
  • Are you using node on windows subsystem for Linux by any chance? Commented Nov 27, 2017 at 6:26
  • Version 5.5.1 of NPM and I'm not using node on a Linux or subsystem. I have a microsoft pro. Commented Nov 27, 2017 at 6:31

1 Answer 1

1

Use double quotes in your script as single quotes won't recognize in Windows command line.

Change your start to:

"start": "nodemon src/app.js --exec \"npm run lint && node\"",
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.