npx pod install 失败,node_modules 为空

Posted

技术标签:

【中文标题】npx pod install 失败,node_modules 为空【英文标题】:npx pod install fails with empty node_modules 【发布时间】:2021-12-23 13:37:49 【问题描述】:

编辑

我最终升级了 ios 版本并使用 Rosetta 运行了 iterm2,Pod 安装终于成功了。当我应该使用cd ios/ && pod install时,我也在使用npx pod install

原创

我正在设置一台新的笔记本电脑,终于开始重新构建我的 React 本机应用程序,但遇到了 npx pod install 的问题。

npx pod install
Need to install the following packages:
  pod
Ok to proceed? (y) y
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated chokidar@1.7.0: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated mkdirp@0.3.5: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated connect@2.30.2: connect 2.x series is deprecated
npm WARN deprecated coffee-script@1.8.0: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated core-js@1.2.7: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code ENOENT
npm ERR! syscall chmod
npm ERR! path /Users/myuser/.npm/_npx/a0ca5f5666585aa2/node_modules/pod/node_modules/pm2/bin/pm2
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, chmod '/Users/myuser/.npm/_npx/a0ca5f5666585aa2/node_modules/pod/node_modules/pm2/bin/pm2'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/myuser/.npm/_logs/2021-11-11T00_43_21_277Z-debug.log

当我查看这些 npx 目录时,它们在 node_modules 中从来没有任何内容。

【问题讨论】:

你到底想做什么?在快速浏览 pod 文档时,我没有看到 pod install 作为命令。 抱歉 @Trott 我从 npx pod install 命令中修剪了其余的日志。其余的日志行是关于不推荐使用的包。 【参考方案1】:

查看pod package.json file,它似乎依赖于安装在模块自己的node_modules 目录中的pm2,但这不是npx 做事的方式。这就是为什么您会收到 pm2 模块的 ENOENT(基本上是“找不到路径”)作为您的错误消息。

最简单的解决方案可能是不使用npxpod,而是使用the README instructs 并将pod 安装为带有npm install -g pod 的全局包。然后运行pod install 而不是npx pod install

【讨论】:

谢谢。我的命令错误,所以最终它是旧 iOS 版本的组合,而我使用了错误的命令,让我陷入了这个困境。很抱歉浪费了您的时间。

以上是关于npx pod install 失败,node_modules 为空的主要内容,如果未能解决你的问题,请参考以下文章

每次我运行 npx create-react-app my-app 时,它都会在 npm start 后显示这个 html webpack 错误

iOS开发中的错误整理,pod文件Install失败

xcode pod install 安装失败,提示缺少文件

pod install 失败并出现错误:在 iOS 中安装 pod 时 `Podfile` 需要 Library (from `../`)`

运行 pod install 时 Flutter iOS 构建失败

iOS pod install 失败深度解决方案