我正在编写一个简单的React应用,该应用由 create-react-app 生成,并且希望对 sqlite3 数据库使用 sequelize 。
我正在遵循以下指示:
但是,运行
时遇到了这个问题yarn build
我得到的错误:
yarn run v1.12.3
$ react-scripts build
Creating an optimized production build...
Failed to compile.
./node_modules/sequelize/lib/dialects/mssql/query.js
Cannot find module: 'tedious'. Make sure this package is installed.
You can install this package by running: yarn add tedious.
我可以继续添加繁琐的,但随后还需要添加它们:
不确定为什么需要这些吗?
这是项目 package.json
的内容{
"name": "xxx",
"version": "0.1.0",
"private": true,
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build"
},
"dependencies": {
"@material-ui/core": "^3.9.0",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"react-scripts": "2.1.3",
"sequelize": "^4.42.0",
"sqlite3": "^4.0.6"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
我唯一引用Sequelize的地方是 src / index.js (作为测试)
const Sequelize = require('sequelize');
当使用sqlite3时,我不确定为什么续集需要乏味(因为乏味是mssql的依赖项)。
我遇到过这个线程-https://github.com/sequelize/sequelize/issues/7509,但是我没有使用webpack。
有什么想法吗?