【问题标题】:EPERM: operation not permitted, chmod @react-native-community iOSEPERM:不允许操作,chmod @react-native-community iOS
【发布时间】:2020-04-12 00:48:46
【问题描述】:

我正在使用 React 16.8.6 和 react-native 0.59.6。 iOS。

在输入 react-native --version 或任何带有 react-native 前缀的东西时,会显示以下错误。

internal/fs/utils.js:220
    throw err;
    ^

Error: EPERM: operation not permitted, chmod '/usr/local/lib/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/server/external/xsel'
    at Object.chmodSync (fs.js:1104:3)
    at Object.<anonymous> (/usr/local/lib/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/server/copyToClipBoard.js:50:15)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/server/middleware/copyToClipBoardMiddleware.js:8:47)
    at Module._compile (internal/modules/cjs/loader.js:956:30) {
  errno: -1,
  syscall: 'chmod',
  code: 'EPERM',
  path: '/usr/local/lib/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/server/external/xsel'
}

我清理了项目。重新启动它。

删除 npm 包并重新安装。

试过 npm install -g react-native-cli

我在 package.lock.json 依赖项中有 react-native-community/cli 版本 1.12.0

我不知道该怎么做。我无法链接任何需要 react-native 关键字的库和其他东西。

此外, 如果我使用像 sudo react-native --version 这样的 sudo 运行它,它会给出如下所述的结果。

warn Your project is using deprecated "rnpm" config that will stop working from next release. Please use a "react-native.config.js" file to configure the React Native CLI. Migration guide: https://github.com/react-native-community/cli/blob/master/docs/configuration.md
warn The following packages use deprecated "rnpm" config that will stop working from next release:
  - react-native-google-signin: https://github.com/react-native-community/react-native-google-signin
  - react-native-video: https://github.com/react-native-community/react-native-video#readme
Please notify their maintainers about it. You can find more details at https://github.com/react-native-community/cli/blob/master/docs/configuration.md#migration-guide.
3.0.4

请就此提出一些指导意见。

谢谢。

【问题讨论】:

  • 你解决了吗?

标签: ios react-native npm react-native-cli


【解决方案1】:

rm -rf node_modules &amp;&amp; npm install这会解决你的问题。

这是因为依赖包的兼容性问题。尝试从目录中移动/删除 package-lock.json 并重新安装。

【讨论】:

  • 任何解释为什么?
  • 是因为依赖包的兼容性问题。尝试从目录中移动/删除 package-lock.json 并再次进行安装。
【解决方案2】:

我有同样的问题。删除 node_modules 并再次安装它们可以解决问题。

【讨论】:

    【解决方案3】:

    从 node_modules 中卸载 react-native 模块并重新安装。

    sudo npm 卸载 react-native sudo npm install react-native

    【讨论】:

      猜你喜欢
      • 2014-09-09
      • 2021-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-31
      • 2019-10-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多