Link to home
Start Free TrialLog in
Avatar of mikha
mikhaFlag for United States of America

asked on

How to enable required commands in a node.js project?

I cloned a project and following is the content on package.json file. I ran npm install which should install all the packages needed to run the project. one of the dependencies listed is the sequlize ORM and sequelize CLI.  I need to run this command -> sequelize db:migrate . when i try to run it from the project root folder, it doesn't recognize the sequelize command. but when I navigate to node_modules/.bin folder, it recognizes the command. but I can't run the command from the bin folder because the command needs to read configuration from config.json file which is in the root level.

How do I enable sequelize globally , in such scenario?

{
  "name": "jiujya",
  "dependencies": {
    "@material-ui/core": "^4.9.13",
    "@material-ui/icons": "^4.9.1",
    "@material-ui/lab": "4.0.0-alpha.39",
    "axios": "^0.19.2",
    "dotenv": "^8.2.0",
    "mysql": "^2.18.1",
    "mysql2": "^2.1.0",
    "next": "9.1.7",
    "prettier": "^1.19.1",
    "react": "16.12.0",
    "react-dom": "16.12.0",
    "react-router": "^5.2.0",
    "react-router-dom": "^5.2.0",
    "sequelize": "^5.21.7",
    "sequelize-cli": "^5.5.1"
  },
  "devDependencies": {
    "@types/node": "^13.13.5",
    "@types/react": "^16.9.34",
    "@types/react-dom": "^16.9.7",
    "@types/react-router": "^5.1.7",
    "@types/react-router-dom": "^5.1.5",
    "typescript": "^3.8.3"
  }
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial