npm 安装时反应导航错误
React Navigation Error on npm install
我正在尝试使用 React 导航创建一个新的 React 本机应用程序。
我做了以下事情:
1.) create-react-native-app myAppName
2.) cd myAppName/
3.) npm install --save react-navigation
4.) 期待成功安装 react-navigation 但我却得到:
C:\Users\Maima\Documents\GitHub\React\test>npm install --save react-navigation
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\jest.cmd as it wasn't installed by C:\Users\Maima\Documents\GitHub\React\t
est\node_modules\jest
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\jest as it wasn't installed by C:\Users\Maima\Documents\GitHub\React\test\
node_modules\jest
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\rimraf.cmd as it wasn't installed by C:\Users\Maima\Documents\GitHub\React
\test\node_modules\rimraf
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\rimraf as it wasn't installed by C:\Users\Maima\Documents\GitHub\React\tes
t\node_modules\rimraf
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\uuid.cmd as it wasn't installed by C:\Users\Maima\Documents\GitHub\React\t
est\node_modules\uuid
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\uuid as it wasn't installed by C:\Users\Maima\Documents\GitHub\React\test\
node_modules\uuid
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\semver.cmd as it wasn't installed by C:\Users\Maima\Documents\GitHub\React
\test\node_modules\semver
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\semver as it wasn't installed by C:\Users\Maima\Documents\GitHub\React\tes
t\node_modules\semver
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN react-navigation@1.0.0-beta.23 requires a peer of react@* but none is i
nstalled. You must install peer dependencies yourself.
npm WARN react-navigation@1.0.0-beta.23 requires a peer of react-native@* but no
ne is installed. You must install peer dependencies yourself.
npm WARN react-native-tab-view@0.0.74 requires a peer of react@* but none is ins
talled. You must install peer dependencies yourself.
npm WARN react-native-tab-view@0.0.74 requires a peer of react-native@* but none
is installed. You must install peer dependencies yourself.
npm WARN react-native-drawer-layout-polyfill@1.3.2 requires a peer of react-nati
ve@* but none is installed. You must install peer dependencies yourself.
npm WARN react-native-drawer-layout@1.3.2 requires a peer of react@* but none is
installed. You must install peer dependencies yourself.
npm WARN react-native-drawer-layout@1.3.2 requires a peer of react-native@* but
none is installed. You must install peer dependencies yourself.
+ react-navigation@1.0.0-beta.23
added 8 packages, removed 973 packages and updated 20 packages in 259.667s
请帮助,无法 npm 启动我的 React Native 应用程序。
我无法评论,因为我没有积分,所以这是一个暂定的答案:
我在 Windows 的 运行ning 世博会上遇到了类似的问题。解决我不得不关闭 XDE 并重新安装。
如果这还不够,请删除 "node_modules" 文件夹和 运行 "npm install"。
它们不是错误,只是警告,告诉您未安装导航所依赖的某些对等依赖项。根据您的命令,您需要 运行 npm install
或 yarn install
来安装所有软件包。使用 create-react-native
应用程序创建应用程序会为您提供软件包列表,但您必须使用 npm install
实际安装它们。如果发生奇怪的事情,请按照@vbandrade 的建议进行操作并冲洗你的 node_modules 和 package.lock
,然后再做一个新的 npm install
可以通过运行再次执行npm install
命令并重新安装npm install --save react-navigation
命令来解决
当我尝试 运行 npm install --save react-navigation
时出现同样的错误。结果我需要 运行 npm install
在 npm install --save react-navigation
.
之前
已按照步骤操作,但 npm install
出现错误。我也在使用 Expo(如@vbandrade 所述),但也存在问题。首先,我认为 react-navigation
变化很大。在尝试了很多之后(在接受的答案中应用解决方案之前),我多次安装了 react-navigation
及其依赖项,并且在我第一次 运行;
时它一次工作
npm install react-navigation
然后
npm install @react-navigation/native
(这对我来说意义不大,因为它是通过 react-navigation 自动安装的)。然后我运行;
npm install react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view
用于安装依赖项并且它有效。老实说,我不明白它是如何工作的。因此,为了学习,我安装了该项目并使用 expo 重新安装了它,之后没有任何效果。所以我应用了@vbandrade 的答案,但在我 运行 npm install
.
之后它给出了更多错误
为了消除这些错误,我找到了另一个解决方案(来自 Whosebug)。这是 solution.First of all 删除 node_modules
文件夹和 package-lock.json
文件并关闭你的编辑器或你的项目打开的任何其他文件(因为节点不会安装一些包,如果项目是打开)。
然后,
先运行这条命令;
npm cache clean --force
然后,
npm install
然后;
npm 安装反应导航
最后安装依赖项;
npm install react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view
运行 你的项目;
如果使用世博会;
expo start
错误现在必须消失。
如果您是 运行 expo 服务器,请停止服务器并继续 npm install --save react-navigation 。它对我有用。
我正在尝试使用 React 导航创建一个新的 React 本机应用程序。
我做了以下事情:
1.) create-react-native-app myAppName
2.) cd myAppName/
3.) npm install --save react-navigation
4.) 期待成功安装 react-navigation 但我却得到:
C:\Users\Maima\Documents\GitHub\React\test>npm install --save react-navigation
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\jest.cmd as it wasn't installed by C:\Users\Maima\Documents\GitHub\React\t
est\node_modules\jest
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\jest as it wasn't installed by C:\Users\Maima\Documents\GitHub\React\test\
node_modules\jest
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\rimraf.cmd as it wasn't installed by C:\Users\Maima\Documents\GitHub\React
\test\node_modules\rimraf
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\rimraf as it wasn't installed by C:\Users\Maima\Documents\GitHub\React\tes
t\node_modules\rimraf
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\uuid.cmd as it wasn't installed by C:\Users\Maima\Documents\GitHub\React\t
est\node_modules\uuid
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\uuid as it wasn't installed by C:\Users\Maima\Documents\GitHub\React\test\
node_modules\uuid
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\semver.cmd as it wasn't installed by C:\Users\Maima\Documents\GitHub\React
\test\node_modules\semver
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\semver as it wasn't installed by C:\Users\Maima\Documents\GitHub\React\tes
t\node_modules\semver
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN react-navigation@1.0.0-beta.23 requires a peer of react@* but none is i
nstalled. You must install peer dependencies yourself.
npm WARN react-navigation@1.0.0-beta.23 requires a peer of react-native@* but no
ne is installed. You must install peer dependencies yourself.
npm WARN react-native-tab-view@0.0.74 requires a peer of react@* but none is ins
talled. You must install peer dependencies yourself.
npm WARN react-native-tab-view@0.0.74 requires a peer of react-native@* but none
is installed. You must install peer dependencies yourself.
npm WARN react-native-drawer-layout-polyfill@1.3.2 requires a peer of react-nati
ve@* but none is installed. You must install peer dependencies yourself.
npm WARN react-native-drawer-layout@1.3.2 requires a peer of react@* but none is
installed. You must install peer dependencies yourself.
npm WARN react-native-drawer-layout@1.3.2 requires a peer of react-native@* but
none is installed. You must install peer dependencies yourself.
+ react-navigation@1.0.0-beta.23
added 8 packages, removed 973 packages and updated 20 packages in 259.667s
请帮助,无法 npm 启动我的 React Native 应用程序。
我无法评论,因为我没有积分,所以这是一个暂定的答案:
我在 Windows 的 运行ning 世博会上遇到了类似的问题。解决我不得不关闭 XDE 并重新安装。
如果这还不够,请删除 "node_modules" 文件夹和 运行 "npm install"。
它们不是错误,只是警告,告诉您未安装导航所依赖的某些对等依赖项。根据您的命令,您需要 运行 npm install
或 yarn install
来安装所有软件包。使用 create-react-native
应用程序创建应用程序会为您提供软件包列表,但您必须使用 npm install
实际安装它们。如果发生奇怪的事情,请按照@vbandrade 的建议进行操作并冲洗你的 node_modules 和 package.lock
,然后再做一个新的 npm install
可以通过运行再次执行npm install
命令并重新安装npm install --save react-navigation
命令来解决
当我尝试 运行 npm install --save react-navigation
时出现同样的错误。结果我需要 运行 npm install
在 npm install --save react-navigation
.
已按照步骤操作,但 npm install
出现错误。我也在使用 Expo(如@vbandrade 所述),但也存在问题。首先,我认为 react-navigation
变化很大。在尝试了很多之后(在接受的答案中应用解决方案之前),我多次安装了 react-navigation
及其依赖项,并且在我第一次 运行;
npm install react-navigation
然后
npm install @react-navigation/native
(这对我来说意义不大,因为它是通过 react-navigation 自动安装的)。然后我运行;
npm install react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view
用于安装依赖项并且它有效。老实说,我不明白它是如何工作的。因此,为了学习,我安装了该项目并使用 expo 重新安装了它,之后没有任何效果。所以我应用了@vbandrade 的答案,但在我 运行 npm install
.
为了消除这些错误,我找到了另一个解决方案(来自 Whosebug)。这是 solution.First of all 删除 node_modules
文件夹和 package-lock.json
文件并关闭你的编辑器或你的项目打开的任何其他文件(因为节点不会安装一些包,如果项目是打开)。
然后,
先运行这条命令;
npm cache clean --force
然后,
npm install
然后;
npm 安装反应导航
最后安装依赖项;
npm install react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view
运行 你的项目;
如果使用世博会;
expo start
错误现在必须消失。
如果您是 运行 expo 服务器,请停止服务器并继续 npm install --save react-navigation 。它对我有用。