我正在使用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
请就此提出一些指导。
谢谢。
答案 0 :(得分:3)
CATEGORY
,这将解决您的问题。
这是因为从属软件包的兼容性问题。尝试从目录中移动/删除package-lock.json并再次进行安装。
答案 1 :(得分:0)
我有同样的问题。删除node_modules
并再次安装它们可以解决问题。
答案 2 :(得分:-1)
从node_modules卸载react-native模块,然后重新安装。
sudo npm卸载react-native sudo npm install react-native