I am trying to start my first React Native project (https://facebook.github.io/react-native/docs/getting-started.html). The first command it says to do on this page is
npm install -g expo-cli
Which produces the following ERROR message .
npm WARN checkPermissions Missing write access to /Users/~/.npm-packages/lib/node_modules/expo-cli/node_modules/ansi-escapes
.
.
.
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/Users/~/.npm-packages/lib/node_modules/expo-cli/node_modules/ansi-escapes'
npm ERR! If you believe this might be a permissions issue, please double-check the permissions of the file and its containing directories, or try running the command again as root/Administrator (though this is not recommended).
So I used the sudo command:
sudo npm install -g expo-cli
This command successfully passed, outputting some warnings (i.e. skipping optional dependencies):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @expo/ngrok-bin-freebsd-ia32@2.2.8 (node_modules/expo-cli/node_modules/@expo/ngrok-bin-freebsd-ia32):
.
.
.
+ expo-cli@2.7.0
updated 2 packages in 13.452s
Then, as the React Native page instructs, I run this command to use expo:
expo init
Here is the result:
zsh: command not found: expo
I tried the same thing with "expo start" and have spent over two hours researching this problem, to no avail. Thank you very much.
~ represents the username