无论我做什么,我都一直出现错误。实际上,我正在使用mongoose和babel-watch将mongoDB作为服务器构建应用程序,但是每次运行babel-watch
时,都会出现此错误:
Error cannot find module 'core-js/es6'
我已经使用core.js
安装并重新安装了npm install core.js
,但是没有任何变化。请帮忙。
这些是我在项目中安装的依赖项:
"dependencies": {
"body-parser": "^1.19.0",
"core-js": "^2.6",
"cuid": "^2.1.6",
"express": "^4.17.1",
"limax": "^1.7.0",
"mongoose": "^5.6.9",
"node-gyp": "^5.0.3"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-loader": "^8.0.6",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"babel-watch": "^7.0.0",
"nodemon": "^1.19.1"
}
}
答案 0 :(得分:1)
对于在 App.tsx 中导入 core.js v3.9 的下一行:import "core-js/es";
答案 1 :(得分:0)
鉴于您正在使用core-js v2.6.9,因此路径应为core-js/library/es6
,如示例here在文档中所示。