m220js-ch0-README-running-the application

My “npm start” doesn’t work. It can’t find mflix-js/index.js

I have installed nodemon and my package.json is

{
  "name": "server",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "nodemon -L ./index.js",
    "test": "jest --passWithNoTests",
    "test:watch": "jest --passWithNoTests --watch",
    "changestream:update": "node test/lessons/change-updates.js",
    "changestream:insert": "node test/lessons/change-insert.js"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "linters": {
      "*.js": [
        "prettier --write",
        "eslint --fix",
        "npm test",
        "git add"
      ]
    },
    "ignore": [
      "**/build/**",
      "**/data/**"
    ]
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "babel-eslint": "^9.0.0",
    "bcryptjs": "^2.4.3",
    "bluebird": "^3.5.1",
    "body-parser": "^1.18.3",
    "chai": "^4.1.2",
    "cors": "^2.8.4",
    "dotenv": "^6.0.0",
    "eslint": "^4.19.1",
    "eslint-config-prettier": "^3.1.0",
    "eslint-config-react-app": "^2.1.0",
    "eslint-plugin-flowtype": "^2.47.1",
    "eslint-plugin-import": "^2.12.0",
    "eslint-plugin-jsx-a11y": "^6.2.3",
    "eslint-plugin-prettier": "^2.6.0",
    "eslint-plugin-react": "^7.8.2",
    "express": "^4.16.3",
    "faker": "^4.1.0",
    "jest-runner": "^24.9.0",
    "jsonwebtoken": "^8.3.0",
    "mocha": "^5.2.0",
    "mongodb": "^3.1.6",
    "morgan": "^1.9.1",
    "npm-check-updates": "^3.1.21",
    "prettier": "^1.14.3",
    "sinon": "^5.0.10"
  },
  "devDependencies": {
    "@babel/core": "^7.5.5",
    "@babel/plugin-proposal-class-properties": "^7.0.0",
    "@babel/plugin-proposal-decorators": "^7.0.0",
    "@babel/plugin-proposal-do-expressions": "^7.0.0",
    "@babel/plugin-proposal-export-default-from": "^7.0.0",
    "@babel/plugin-proposal-export-namespace-from": "^7.0.0",
    "@babel/plugin-proposal-function-sent": "^7.0.0",
    "@babel/plugin-proposal-json-strings": "^7.0.0",
    "@babel/plugin-proposal-logical-assignment-operators": "^7.0.0",
    "@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0",
    "@babel/plugin-proposal-numeric-separator": "^7.0.0",
    "@babel/plugin-proposal-optional-chaining": "^7.0.0",
    "@babel/plugin-proposal-pipeline-operator": "^7.0.0",
    "@babel/plugin-proposal-throw-expressions": "^7.0.0",
    "@babel/plugin-syntax-dynamic-import": "^7.0.0",
    "@babel/plugin-syntax-import-meta": "^7.0.0",
    "@babel/plugin-transform-runtime": "^7.5.5",
    "@babel/preset-env": "^7.5.5",
    "@babel/register": "^7.5.5",
    "@babel/runtime": "^7.5.5",
    "babel-core": "^7.0.0-bridge.0",
    "babel-jest": "^23.4.2",
    "concurrently": "^3.5.1",
    "husky": "^1.0.0",
    "jest": "^25.0.0",
    "jest-cli": "^25.0.0",
    "jest-express": "^1.6.0",
    "lint-staged": "^7.3.0",
    "nodemon": "^1.17.5"
  }
}

which has
“start” : “nodemon -l ./index.js”
in it.
could it be the reason that npm is not starting?

Hi @farideh_gorji,
Did you install all the dependencies before executing the npm start command?
Can you please run the following inside the mflix-js project folder?

rm -rf node_modules
npm install

If you have any doubts, please feel free to reach out to us.

Thanks and Regards.
Sourabh Bagrecha,
MongoDB

1 Like