我正在使用explo-cli来开发一个反应原生项目。我的项目昨天编译得很好,今天我打开它告诉我它找不到模块"./iter-step"。在找不到模块"./iter-step"之前,它告诉我它找不到"babel-runtime"。为了解决这两个问题,我刚刚运行了 npm install --save [缺少包名称],它似乎有效,两次它都让我回到了我发布的当前错误。
"Metro 捆绑器遇到内部错误,请检查您的终端错误输出以获取更多详细信息"
[15:12:06] undefined
[15:12:06] Failed building JavaScript bundle.
Building JavaScript bundle [===============================================] 99
我从未明确导入过"babel-runtime"或"core-js",所以我的项目抱怨它们丢失的感觉是随机的。也许是一个 vscode 扩展,我在我不知情的情况下将它们放在我的代码中的某个地方。有人遇到过这个问题吗?
这是我的新包.json。
{
"name": "empty-project-template",
"main": "node_modules/expo/AppEntry.js",
"private": true,
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"eject": "expo eject"
},
"dependencies": {
"babel-runtime": "^6.26.0",
"core-js": "^2.6.3",
"expo": "^30.0.1",
"firebase": "^5.8.0",
"moment": "^2.23.0",
"number-is-nan": "^1.0.1",
"react": "16.3.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz",
"react-native-calendars": "^1.21.0",
"react-native-router-flux": "^4.0.6",
"react-navigation": "^3.0.9",
"react-redux": "^6.0.0",
"redux": "^4.0.1",
"redux-thunk": "^2.3.0",
"styled-components": "^4.1.3",
"styled-icons": "^6.4.0"
}
}
删除node_modules目录并再次运行npm install
就像 Talgat 建议的那样。
删除node_modules文件夹,然后执行npm安装命令,我认为它会起作用