无法使用WebStorm创建React Native应用程序

时间:2019-06-06 11:55:08

标签: react-native npm webstorm yarnpkg

我想使用WebStorm创建React Native Application。但是这样做会发生一些错误。

/usr/local/bin/node /usr/local/lib/node_modules/react-native-cli/index.js init untitled
yes
prompt: Directory untitled already exists. Continue?:  (no) yes
This will walk you through creating a new React Native project in /Users/sinamnouri/ReactNative/untitled
Using yarn v1.16.0
Installing react-native...
yarn add v1.16.0
error An unexpected error occurred: "EACCES: permission denied, scandir '/Users/sinamnouri/.config/yarn/link'".
info If you think this is a bug, please open a bug report with the information provided in "/Users/sinamnouri/ReactNative/untitled/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Error: Command failed: yarn add react-native --exact
    at checkExecSyncError (child_process.js:616:11)
    at execSync (child_process.js:652:15)
    at run (/usr/local/lib/node_modules/react-native-cli/index.js:294:5)
    at createProject (/usr/local/lib/node_modules/react-native-cli/index.js:249:3)
    at /usr/local/lib/node_modules/react-native-cli/index.js:217:7
    at /usr/local/lib/node_modules/react-native-cli/node_modules/prompt/lib/prompt.js:316:32
    at /usr/local/lib/node_modules/react-native-cli/node_modules/async/lib/async.js:142:25
    at assembler (/usr/local/lib/node_modules/react-native-cli/node_modules/prompt/lib/prompt.js:313:9)
    at /usr/local/lib/node_modules/react-native-cli/node_modules/prompt/lib/prompt.js:322:32
    at /usr/local/lib/node_modules/react-native-cli/node_modules/prompt/lib/prompt.js:597:5 {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 16730,
  stdout: null,
  stderr: null
}
Command `yarn add react-native --exact` failed.
Done

它看起来与权限有关,如何在WebStorm中处理权限。

1 个答案:

答案 0 :(得分:0)

您无法在WebStorm中处理权限(这实际上与IDE无关)。此类错误通常意味着.config中的HOME文件夹不归您所有,因此您无权对其进行写入。检查您的用户(运行WebStorm的用户)在~/.config中是否具有正确的特权,并为其提供所需的权限(sudo chown -R $USER:$GROUP ~/.config