无法安装react-native-navigation来响应本机项目,提示“错误代码ENOENT”

时间:2018-12-25 05:51:22

标签: npm npm-install node-modules react-native-navigation

我正在使用 react-native 创建一个移动应用,并试图实现导航。在本机文档中,他们将其称为最佳导航模块,以使本机外观/感觉/性能react-native-navigation包(由wix提供)。当我启动运行npm install的安装过程时,它会引发错误。这是报告失败原因的错误行:

666 warn optional SKIPPING OPTIONAL DEPENDENCY: nan@2.12.1 (node_modules\nan):
667 warn enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\Workspace\pokemonn\node_modules\nan' -> 'D:\Workspace\pokemonn\node_modules\.nan.DELETE'
668 verbose enoent SKIPPING OPTIONAL DEPENDENCY: This is related to npm not being able to find a file.
668 verbose enoent SKIPPING OPTIONAL DEPENDENCY:
669 verbose stack Error: ENOENT: no such file or directory, rename 'D:\Workspace\pokemonn\node_modules\hoist-non-react-statics' -> 'D:\Workspace\pokemonn\node_modules\.hoist-non-react-statics.DELETE'
670 verbose cwd D:\Workspace\pokemonn
671 verbose Windows_NT 10.0.17134
672 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\**\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "react-native-navigation"
673 verbose node v11.4.0
674 verbose npm  v6.4.1
675 error path D:\Workspace\pokemonn\node_modules\hoist-non-react-statics
676 error code ENOENT
677 error errno -4058
678 error syscall rename
679 error enoent ENOENT: no such file or directory, rename 'D:\Workspace\pokemonn\node_modules\hoist-non-react-statics' -> 'D:\Workspace\pokemonn\node_modules\.hoist-non-react-statics.DELETE'
680 error enoent This is related to npm not being able to find a file.
681 verbose exit [ -4058, true ]

我检查了打开/关闭的github问题,以及一些stackoverflow帖子。他们都建议重新安装该节点,或删除package-lock.json文件,但似乎没有一个起作用。

我正在Windows机器上运行react-native,并安装了节点10.x LTS和npm 6.x和react-native 0.57.8。由于window仅具有针对Android构建的功能,因此我仅针对android构建。

1 个答案:

答案 0 :(得分:0)

这个问题早就解决了,我忘了在这里更新。

在github上打开了一个线程,后来我发现它与npm安装有关。按照上述步骤操作后,我就可以安装它了。 步骤如下:

从项目文件夹中删除 node_modules 目录和 package-lock.json 文件 输入npm cache clean --force并按Enter 输入npm install -g react-native-navigation,然后按Enter

[更多:Github article]