【问题标题】:`npm install` fails at `git submodule update``npm install` 在`git submodule update` 失败
【发布时间】:2019-02-18 15:36:45
【问题描述】:

我有一个 react-native 应用程序,其中一些依赖项托管在 AWS CodeCommit 上。

我已经在这个项目上工作了一段时间,但是在最近升级 node 和 npm 之后,我无法运行该应用程序。它卡在npm install。这是错误 -

npm ERR! code 1
npm ERR! Command failed: git submodule update -q --init --recursive
npm ERR! warning: templates not found in C:\Users\myComputer\AppData\Local\Temp\pacote-git-template-tmp\git-clone-c78347e9
npm ERR! warning: unable to access 'Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/.gitattributes': Filename too long
npm ERR! warning: unable to access 'Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/.gitattributes': Filename too long
npm ERR! error: unable to create file Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json: Filename too long
npm ERR! warning: unable to access 'Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Content.imageset/.gitattributes': Filename too long
npm ERR! error: unable to create file Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json: Filename too long
npm ERR! warning: unable to access 'Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/.gitattributes': Filename too long
npm ERR! warning: unable to access 'Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/.gitattributes': Filename too long
npm ERR! error: unable to create file Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json: Filename too long
npm ERR! warning: unable to access 'Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Content.imageset/.gitattributes': Filename too long
npm ERR! error: unable to create file Examples/SDWebImage TV Demo/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json: Filename too long
npm ERR! Unable to checkout 'dc5c974b89509992d6c6e0d0510344fd0e35baa6' in submodule path 'ios/Vendor/SDWebImage'
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\myComputer\AppData\Roaming\npm-cache\_logs\2019-02-18T15_22_41_579Z-debug.log

Here 是完整日志文件的链接。

如您所见,我正在使用 Windows 机器。当我尝试在 MacOS 上构建应用程序时,它运行良好。 我尝试了不同版本的 Node、NPM 和 Git,但错误仍然存​​在。

我怀疑这是与 Windows 相关的问题,但不知道如何解决。

【问题讨论】:

  • 你试过清理缓存吗? npm cache clean --force 删除 node_modules 文件夹并重新安装所有软件包?
  • @Maielo 也尝试过npm cache clean --force。没用

标签: react-native npm


【解决方案1】:

好的。我找到了问题和解决方法。

问题是我们使用了 react-native-fast-image 的分叉版本,导致在执行 npm-install 时出现错误。我克隆了我们的 repo 分支并将其链接到 package.json 为 -

"react-native-fast-image": "file:../react-native-fast-image",

而不是 -

"react-native-fast-image": "git+https://github.com/{account-name}/react-native-fast-image.git",

现在解决了这个问题。

【讨论】:

    猜你喜欢
    • 2023-02-26
    • 2021-12-26
    • 2013-11-06
    • 2016-01-06
    • 2016-01-22
    • 2018-01-31
    • 2020-11-12
    • 1970-01-01
    • 2019-02-23
    相关资源
    最近更新 更多