我目前正在开发一个带有 node、react 和 express 的 web 应用程序。我想尝试使用 sequelize-auto 库来测试它是否真的可以为我生成一个模型,所以我不需要输入那么多,也不需要以后多用。但是,我有一个问题,它说即使它在那里也找不到 Sequelize 。我什至用它来获取我的数据并将其显示在正在工作的屏幕上。这是我的 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"
}
}
和我的命令:
sequelize-auto -o "./models" -d Information -h localhost -u secret -p 5000 -x secret# -e tedious -t Information
如果需要更多信息,请告诉我。我觉得即使我现在不使用它也可能非常有用。
最佳答案
您可以在命令中将“sequelize-auto”替换为“node_modules/sequelize-auto/bin/sequelize-auto”。
命令应如下所示:
node_modules/sequelize-auto/bin/sequelize-auto -o "./models" -d Information -h localhost -u secret -p 5000 -x secret# -e tedious -t Information
如果你有 npx
安装(检查 which npx
),您不必费心在 node_modules 中调用二进制“隐藏”。它能够查找二进制文件本身:npx sequelize-auto ..
关于node.js - sequelize-auto 找不到模块 'sequelize',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66127305/