Reputation: 6057
I am trying to get React Native working on my Linux machine. In order to get the cli running I have run:
$ yarn global add react-native-cli
and see:
yarn global v0.16.1
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed [email protected] with binaries:
- react-native
Done in 1.70s.
Everything installs just fine, but when I attempt to create a new React Native project, I get:
$ react-native init Test
react-native: command not found
Come to find out, yarn
is installing the dependency into whatever the current directory is instead of installing it globally. Any help on this? I'm running Lubuntu 16.04.
Upvotes: 3
Views: 3301
Reputation: 15226
Now it works:
yarn config set prefix /usr/local
Check with
yarn config get prefix
Notice that only executables will be installed to this prefix
location. Packages i.e. on Windows are installed in %USERPROFILE%\AppData\Local\Yarn\config\global\node_modules
.
On Windows I do:
mkdir ~/yarn-global
yarn config set prefix ~/yarn-global
Global path isn't configurable permanently yet. We can only read the settings:
> yarn global bin
C:\Program Files\nodejs
When I tried to install elm-upgrade, I got error in log %USERPROFILE%\AppData\Local\Yarn\config\global\yarn-error.log
Trace:
Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\elm-upgrade.cmd'
at Error (native)
But elm-upgrade was installed in %USERPROFILE%\AppData\Local\Yarn\config\global\node_modules\.bin
.
Related:
Upvotes: 1