udacity / reactnd-contacts-complete

Code-along project for the Contacts app
https://www.udacity.com/course/react-nanodegree--nd019
171 stars 579 forks source link

installing prop-types manually appears to destroy react-scripts #2

Open nathanhannig opened 7 years ago

nathanhannig commented 7 years ago

After manually installing prop-types as instructed the react-scripts folder appears to be one of many node modules removed automatically by npm for some reason.

So when npm start is ran from command line, the react-scripts gives an error as it cannot be found.

nathanhannig commented 7 years ago

This is related to lesson 3.6 - State Management - PropTypes

To recreate,

  1. install create-react-app
  2. create a test project using create react app
  3. cd into the project
  4. run npm install --save prop-types
  5. run npm start

At this point you should see a number of errors similar to the below.

`Last login: Mon Jul 31 14:30:42 on ttys002 ➜ ~ cd Documents ➜ Documents cd udacity ➜ udacity cd test ➜ test npm install --save prop-types npm WARN gentlyRm not removing /Users/nathan/Documents/udacity/test/node_modules/.bin/jest as it wasn't installed by /Users/nathan/Documents/udacity/test/node_modules/jest npm WARN gentlyRm not removing /Users/nathan/Documents/udacity/test/node_modules/.bin/uglifyjs as it wasn't installed by /Users/nathan/Documents/udacity/test/node_modules/uglify-js npm WARN gentlyRm not removing /Users/nathan/Documents/udacity/test/node_modules/html-minifier/node_modules/.bin/uglifyjs as it wasn't installed by /Users/nathan/Documents/udacity/test/node_modules/html-minifier/node_modules/uglify-js npm WARN gentlyRm not removing /Users/nathan/Documents/udacity/test/node_modules/espree/node_modules/.bin/acorn as it wasn't installed by /Users/nathan/Documents/udacity/test/node_modules/espree/node_modules/acorn npm WARN gentlyRm not removing /Users/nathan/Documents/udacity/test/node_modules/.bin/browserslist as it wasn't installed by /Users/nathan/Documents/udacity/test/node_modules/browserslist npm WARN gentlyRm not removing /Users/nathan/Documents/udacity/test/node_modules/autoprefixer/node_modules/.bin/browserslist as it wasn't installed by /Users/nathan/Documents/udacity/test/node_modules/autoprefixer/node_modules/browserslist npm notice created a lockfile as package-lock.json. You should commit this file.

test@0.1.0 start /Users/nathan/Documents/udacity/test 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! test@0.1.0 start: react-scripts start npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the test@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/nathan/.npm/_logs/2017-07-31T22_10_28_189Z-debug.log ➜ test`

ghoshabhi commented 7 years ago

Can you also post your node and creact-react-app version that you're using ?

nathanhannig commented 7 years ago

node --version v6.11.0

create-react-app --version 1.3.3

npm --version 5.3.0

nathanhannig commented 7 years ago

I have determined the issue is related to yarn and npm being both installed.

When create-react-app is used to create the project and yarn is installed, it appears that it expects future installs to be performed using the yarn commands.

Many students are installing yarn because of the video in Lesson 2.3. https://www.youtube.com/watch?time_continue=10&v=WmYSd7OEjMM

However, follow up lessons provide the install of packages using npm commands.

The causes a conflict of control between yarn and npm.

Once I uninstalled yarn and created a new create-react-app project, I no longer received these issues.

I believe a warning needs to be added to the lesson and youtube video mentioned above.

ardithastopalli commented 6 years ago

any solution?

anandprabhu commented 6 years ago

@ardithastopalli using the command yarn install and starting the server again using yarn start resolves the issue for me.