【问题标题】:react-native init AwesomeProject gives an error EPERM: operation not permitted, chmod '/node_modules/@react-native-com...'react-native init AwesomeProject 给出错误 EPERM: operation not allowed, chmod '/node_modules/@react-native-com...'
【发布时间】:2020-05-28 10:38:52
【问题描述】:

安装 brew、watchman 和 node 后。我尝试从 Mac 机器上的终端启动我的第一个 react-native 应用程序。

当我运行React Native Development site 上所说的命令时 - React Native CLI Quickstart for macOS 和 iOS 目标。

npx react-native init AwesomeProject 

我收到以下错误

EPERM: operation not permitted, chmod '/usr/local/lib/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/server/external/xsel'

我以管理员身份登录,所以这不是问题,我什至尝试过“sudo”,但没有成功。

有人遇到过类似的问题吗?

提前致谢。

【问题讨论】:

    标签: macos react-native mobile npx


    【解决方案1】:

    您似乎遇到了权限问题尝试使用您的用户名更改对 react-native 文件夹的权限。

    sudo chown userName -R [PATH]
    

    要知道您的用户名,请在终端中运行此命令

    whoami
    

    或者只是执行以下操作

    关闭所有 VS Code 实例。

    清理缓存

    npm cache clean --force
    

    以管理员身份全局安装最新版本的 npm:

    npm install -g npm@latest --force
    

    清理缓存

    npm cache clean --force
    

    尝试再次安装您的组件。

    您可能需要暂时禁用防病毒程序并重试。

    【讨论】:

    • 能否给出具体路径?完整路径在问题中,您能指定吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-10-28
    • 1970-01-01
    • 2017-04-24
    • 1970-01-01
    • 2019-07-16
    • 2021-12-04
    • 2019-04-04
    相关资源
    最近更新 更多