I'm taking a course on Udemy where we are going to use create-react-app
. But when I come to run npm start
and/or yarn start
, I get an error.
This is the course: Complete React Developer in 2020 (w: Redux, Hooks, GraphQL)
npx create-react-app test-npm (and --use-npm if i'm using npm)
We suggest that you begin by typing:
cd test
npm start
Happy hacking!
➜ Complete React Developer in 2020 (w: Redux, Hooks, GraphQL) cd test
➜ test-npm git:(master) npm or yarn start
test-npm@0.1.0 start /Users/user/Udemy/Complete React Developer in 2020 (w: Redux, Hooks, GraphQL)/test react-scripts start
Result with npm:
sh: react-scripts: command not found npm ERR! code ELIFECYCLE npm ERR! syscall spawn npm ERR! file sh npm ERR! errno ENOENT npm ERR! test@0.1.0 start: `react-scripts start` npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the test-npm@0.1.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /Users/user/.npm/_logs/2020-01-23T18_09_30_919Z-debug.log
Result with yarn:
➜ test-yarn git:(master) yarn start yarn run v1.21.1 $ react-scripts start /bin/sh: react-scripts: command not found error Command failed with exit code 127. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I'm on mac (newest iOS), and using zsh with oh my zsh.
My .zshrc file:
(#) If you come from bash you might have to change your $PATH.
(#) export PATH=$HOME/bin:/usr/local/bin:$PATH
(#)Path to your oh-my-zsh installation.
export ZSH="/Users/mhagen/.oh-my-zsh"
ZSH_THEME="robbyrussell"
plugins=(git nvm)
source $ZSH/oh-my-zsh.sh
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
My .bash_profile file:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
I have installed:
➜ ~ nvm --version
0.35.2
➜ ~ node -v
v13.7.0
➜ ~ npm -v
6.13.6
➜ ~ yarn -v
1.21.1
I have tried to delete node_modules
and package-lock/yarn lock files and installed them with both npm and yarn (deleted the project and new file every time).
I have tried to install create-react-app globally. But none of the tips I've found are working.
Hoping someone here can see what my problem is :/