user7496931
user7496931

Reputation: 1519

After using create-react-app, any packages I install break my code?

I created a sample app with create-react-app, I start my project and used npm install prop-types to install the package. I got a bunch of warnings:

npm WARN rm not removing /Users/carlosgrijalva/Programming/sample/node_modules/.bin/jest as it wasn't installed by /Users/carlosgrijalva/Programming/sample/node_modules/jest
npm WARN rm not removing /Users/carlosgrijalva/Programming/sample/node_modules/.bin/regjsparser as it wasn't installed by /Users/carlosgrijalva/Programming/sample/node_modules/regjsparser
npm WARN rm not removing /Users/carlosgrijalva/Programming/sample/node_modules/.bin/jsesc as it wasn't installed by /Users/carlosgrijalva/Programming/sample/node_modules/jsesc
npm WARN rm not removing /Users/carlosgrijalva/Programming/sample/node_modules/fsevents/node_modules/.bin/node-pre-gyp as it wasn't installed by /Users/carlosgrijalva/Programming/sample/node_modules/fsevents/node_modules/node-pre-gyp
npm WARN rm not removing /Users/carlosgrijalva/Programming/sample/node_modules/.bin/esparse as it wasn't installed by /Users/carlosgrijalva/Programming/sample/node_modules/esprima
npm WARN rm not removing /Users/carlosgrijalva/Programming/sample/node_modules/.bin/esvalidate as it wasn't installed by /Users/carlosgrijalva/Programming/sample/node_modules/esprima
npm WARN rm not removing /Users/carlosgrijalva/Programming/sample/node_modules/.bin/cssesc as it wasn't installed by /Users/carlosgrijalva/Programming/sample/node_modules/cssesc
npm WARN rm not removing /Users/carlosgrijalva/Programming/sample/node_modules/acorn-globals/node_modules/.bin/acorn as it wasn't installed by /Users/carlosgrijalva/Programming/sample/node_modules/acorn-globals/node_modules/acorn
npm WARN rm not removing /Users/carlosgrijalva/Programming/sample/node_modules/@babel/generator/node_modules/.bin/jsesc as it wasn't installed by /Users/carlosgrijalva/Programming/sample/node_modules/@babel/generator/node_modules/jsesc

And when I ran npm start I got the following errors:

> [email protected] start /Users/carlosgrijalva/Programming/sample
> react-scripts start

sh: react-scripts: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] 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/carlosgrijalva/.npm/_logs/2018-11-02T15_33_21_597Z-debug.log

Below are the my versions for npm, node, and create-react app

node --version: v8.10.0

create-react-app --version: 2.0.4

npm --version: 5.6.0

I have a feeling that the problem is with having both Yarn and NPM installed? Not sure though, anyone ran through this issue?

Upvotes: 2

Views: 2342

Answers (1)

Root
Root

Reputation: 2361

Having both Yarn and NPM installed is fine and won't lead to any problems.Actually many projects will both have yarn and npm to make it easier for more users.

"sh: react-scripts: command not found":About this problem,maybe your node_modules didn't work well.

So,delete your node_modules,and npm npm install again.

And about the warning, you should add a package with npm install prop-types --save instead of npm install prop-types.

Upvotes: 2

Related Questions