reactjs - 为什么在项目中导入 tensorflow js 时会出错
问题描述
仅导入 tensorflow 库甚至不使用其方法时,我收到以下错误。这是错误:
./node_modules/@tensorflow/tfjs-core/dist/io/http.js 错误:/Users/smok/My Projects/Visual/node_modules/@tensorflow/tfjs-core/dist/io/http.js:预期类型“带有未定义选项的表达式”,而是得到了“SpreadElement”。在 Array.map () 在 Array.forEach ()
这是我的 package.json:
"name": "mdbreact-admin-pro",
"version": "4.25.0",
"private": true,
"dependencies": {
"@babel/core": "^7.16.0",
"@babel/preset-env": "^7.16.0",
"@material-ui/core": "^4.12.3",
"@mediapipe/camera_utils": "^0.3.1632432234",
"@mediapipe/control_utils": "^0.6.1629159505",
"@mediapipe/drawing_utils": "^0.3.1620248257",
"@mediapipe/face_detection": "^0.4.1628005423",
"@mediapipe/selfie_segmentation": "^0.1.1632777926",
"@szhsin/react-menu": "^2.0.1",
"@tensorflow-models/body-pix": "^2.0.5",
"@tensorflow/tfjs": "^2.4.0",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"@toast-ui/react-image-editor": "^3.15.0",
"apexcharts": "^3.26.0",
"axios": "^0.19.2",
"babel-core": "^6.26.0",
"babel-preset-env": "^1.6.1",
"capture-frame": "^4.0.0",
"chroma-js": "^2.1.2",
"draft-js": "^0.10.5",
"event-source-polyfill": "^1.0.22",
"google-map-react": "^1.1.0",
"jalali-date": "^1.1.1",
"jalali-moment": "^3.3.10",
"mdbreact": "./mdbreact-4.25.0.tgz",
"node-fetch": "^2.6.1",
"react": "17.0.2",
"react-apexcharts": "^1.3.7",
"react-big-calendar": "^0.20.2",
"react-canvas-draw": "^1.1.1",
"react-compare-image": "^3.1.0",
"react-confirm-alert": "^2.7.0",
"react-dom": "17.0.2",
"react-draft-wysiwyg": "^1.13.2",
"react-hook-form": "^7.6.6",
"react-hot-toast": "^2.0.0",
"react-image-crop": "^8.6.12",
"react-image-size": "^1.0.4",
"react-interval-hook": "^1.1.3",
"react-jvectormap": "^0.0.4",
"react-modern-calendar-datepicker": "^3.1.6",
"react-redux": "^7.2.5",
"react-router": "^5.1.2",
"react-router-dom": "^5.3.0",
"react-scripts": "3.4.3",
"react-switch": "^6.0.0",
"react-thermometer-component": "^1.0.1",
"react-toastify": "^8.0.3",
"react-tooltip": "^4.2.21",
"react-webcam": "^5.2.4",
"reactjs-media": "^1.5.1",
"redux": "^4.0.5",
"redux-mock-store": "^1.5.4",
"redux-promise-middleware": "^6.1.2",
"s": "^1.0.0",
"sass": "^1.36.0",
"tui-color-picker": "^2.2.7"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
解决方案
推荐阅读
- php - 通过兄弟键从 AWS SDK (describeInstances) 中选择多维数组成员
- pandas - 在对多个工作表的多个函数调用中添加多个数据框以 excel
- java - 强制超类包含无参数构造函数
- intellij-idea - 在 IntelliJ 中搜索断点,例如 ReSharper 中的 Navigate > Breakpoints
- r - 如何在 R 中使用自己的函数填充向量
- sql - 将上标字母插入到 VARCHAR2 列中,特别是商标符号
- makefile - 有没有办法在 Makefile 中使用文件快捷方式?
- python - 由于 python 依赖于 Ubuntu 18.04,无法安装 ansible
- python - 如何处理多个 gRPC 期货?
- c++ - 如果找到函数,则启用复制构造函数