None of the above suggestions worked, however, I did discover that this error can occur and become troublsome to fix when using nvm. The problem occurs when the system version of node is different from the shell version set up with nvm. When this happens actions to fix in one version of node don’t fix the version of node that starts with expo ide (the default system version).
Two things need to happen:
First, make sure that every new shell starts with a consistent version of node.js by putting “nvm use 8.7.0” or whatever version you are currently using. That way all shells and expo start with the same version. Type nvm ls’ to make sure that the ‘system’ alias is the version specified.
Second, fix the problem in the correct version of node.js (make sure the right version of node is being used when fixing things with ‘nvm ls’ or if you use another package manager, make sure the
system one is the one you are fixing (in a new shell, check
Apply these fixes, one of which is probably the issue: (a variation on: How to clear the React Native packager) One or more of the below statements may not be a problem, but this represents the sledge hammer solution. XDE users should follow the
npm line of fixes, others can use
- Stop the XDE/exp
- Install a version of npm below 5 (as of October 2017). I read it’s unstable… You can experiment with later versions once you get to a stable install. Yarn works great no matter what from what I can tell, but npm is used by expo XDE and it needs to be a stable version for the version of node it boots into. If you create a new project with the XDE, you will have problems if you haven’t updated npm, you will then have to rely on yarn from the command line nonsense once the project is created by the XDE.
nvm use 8.7.0
npm install firstname.lastname@example.org -g
- Install the latest watchman, something like: (if you have the latest, then the watchman fixes can probably be skipped)
brew reinstall watchman
- remove and reinstall node_modules:
rm -rf node_modules
- Clear your Yarn or npm cache, depending on which you’re using, with
yarn cache clean or
npm cache clean
npm i to install your dependencies again
watchman watch-del-all to clear Watchman’s state
- Delete the packager’s cache directory with
rm -fr $TMPDIR/react-*
- Now start the XDE or exp.
Note: For the expo XDE, it supposedly uses
npm, so steps 5 and 6 are probably not necessary when using the XDE (expo IDE).