[英]React native / node issue: The package was successfully found. However, the package specifies a `main` module field that could not be resolved
I am new to node and React Native and I have an issue that I hope someone can help me resolve.我是 node 和 React Native 的新手,我有一个问题希望有人能帮我解决。 I and another person are making a React Native application and currently I am trying to piece together a backend made by the other person with my frontend and I get the following error:
我和另一个人正在制作一个 React Native 应用程序,目前我正在尝试将另一个人制作的后端与我的前端拼凑在一起,我收到以下错误:
While trying to resolve module http
from file /Users/alex/ParkME/node_modules/node-fetch/index.js
, the package /Users/alex/ParkME/node_modules/http/package.json
was successfully found. While trying to resolve module
http
from file /Users/alex/ParkME/node_modules/node-fetch/index.js
, the package /Users/alex/ParkME/node_modules/http/package.json
was successfully found. However, this package itself specifies a main
module field that could not be resolved ( /Users/alex/ParkME/node_modules/http/index.js
. Indeed, none of these files exist:但是,这个 package 本身指定了一个无法解析的
main
模块字段( /Users/alex/ParkME/node_modules/http/index.js
。事实上,这些文件都不存在:
/Users/alex/ParkME/node_modules/http/index.js(.native||.ios.expo.js|.native.expo.js|.expo.js|.ios.expo.ts|.native.expo.ts|.expo.ts|.ios.expo.tsx|.native.expo.tsx|.expo.tsx|.ios.expo.json|.native.expo.json|.expo.json|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
/Users/alex/ParkME/node_modules/http/index.js/index(.native||.ios.expo.js|.native.expo.js|.expo.js|.ios.expo.ts|.native.expo.ts|.expo.ts|.ios.expo.tsx|.native.expo.tsx|.expo.tsx|.ios.expo.json|.native.expo.json|.expo.json|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
Failed building JavaScript bundle. /Users/alex/ParkME/node_modules/http/index.js/index(.native||.ios.expo.js|.native.expo.js|.expo.js|.ios.expo.ts|.native.expo.ts|.expo.ts|.ios.expo.tsx|.native.expo.tsx|.expo.tsx|.ios.expo.json|.native.expo.json|.expo.json|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
Failed构建 JavaScript 捆绑包。 Does anyone know what the issue might be?有谁知道问题可能是什么?
Is the error coming from your backend or frontend code?错误来自您的后端还是前端代码? And were the node modules included in the code you got from the other person?
您从其他人那里获得的代码中是否包含节点模块? You can try running
npm install
command on the directory to update the dependencies if you haven't already.如果尚未更新依赖项,您可以尝试在目录上运行
npm install
命令来更新依赖项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.