sequelize-auto cannot find module 'sequelize'

915 Views Asked by At

I am currently developing a web app with node,react and express.I wanted to try using the sequelize-auto library to test and see if it can actually generate a model for me so I don't need to type as much and also to use more in future. However, I have an issue with it saying it can't find sequelize even though it is there. I am even using it to get my data and display it onto the screen which is working. This my package.json:

{
  "name": "db-app",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@reduxjs/toolkit": "^1.5.0",
    "auto": "^10.16.0",
    "axios": "^0.21.1",
    "bootstrap": "^4.6.0",
    "cassandra-driver": "^4.6.1",
    "cors": "^2.8.5",
    "express": "^4.17.1",
    "express-validator": "^6.9.2",
    "got": "^11.8.1",
    "materialize-css": "^1.0.0",
    "mssql": "^6.3.1",
    "mysql": "^2.18.1",
    "mysql2": "^2.2.5",
    "mysqljs": "0.0.2-security",
    "react": "^17.0.1",
    "react-bootstrap": "^1.4.3",
    "react-materialize": "^3.9.6",
    "react-redux": "^7.2.2",
    "react-router": "^5.2.0",
    "react-router-dom": "^5.2.0",
    "request": "^2.88.2",
    "sequelize": "^6.5.0",
    "sequelize-auto": "^0.7.10",
    "tedious": "^9.2.3",
    "tedious-connection-pool": "^1.0.5"
  },
  "devDependencies": {
    "redux-devtools": "^3.7.0"
  }
}

and my command:

sequelize-auto -o "./models" -d Information -h localhost -u secret -p 5000 -x secret# -e tedious -t Information

If any more information is needed please let me know. I feel like this could be very useful even if I don't use it now.

1

There are 1 best solutions below

0
Ilham Muhammad On

You can replace "sequelize-auto" with "node_modules/sequelize-auto/bin/sequelize-auto" in your command. Command should look like this:

node_modules/sequelize-auto/bin/sequelize-auto -o "./models" -d Information -h localhost -u secret -p 5000 -x secret# -e tedious -t Information

And if you have npx installed (check with which npx), you don't have to bother calling the binary "hidden" in node_modules. It is capable of looking for the binary itself: npx sequelize-auto ..