facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.69k stars 26.84k forks source link

create-react-app fails due to node_modules being created in a wrong directory on Windows #3326

Closed LeonelAV closed 6 years ago

LeonelAV commented 6 years ago

Is this a bug report?

yes

Can you also reproduce the problem with npm 4.x?

(Write your answer here.)

Which terms did you search for in User Guide?

(Write your answer here if relevant.)

Environment

  1. node -v: 6.10.2
  2. npm -v:4.6.1
  3. yarn --version (if you use Yarn):
  4. npm ls react-scripts (if you haven’t ejected):

Then, specify:

  1. Operating system: windows 10
  2. Browser and version (if relevant):

Steps to Reproduce

(Write your steps here:)

  1. npm install -g create-react-app
  2. create react app name-of-my-project
  3. starts to install react, react-dom and react-scripts and before finish i get an error: Aborting Instalation

Aborting installation.
Unexpected error. Please report it as a bug:
{ Error: Cannot find module 'C:\Users\leonel\Desktop\pseudogram\node_modules\react- scripts\package.json'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at checkNodeVersion (C:\Users\leonel\AppData\Roaming\npm\node_modules\create-re act-app\createReactApp.js:476:23)
at getPackageName.then.then.then.packageName (C:\Users\leonel\AppData\Roaming\n pm\node_modules\create-react-app\createReactApp.js:283:7)
at process._tickCallback (internal/process/next_tick.js:109:7) code: 'MODULE_NO T_FOUND' }

Deleting generated file... package.json
Deleting pseudogram / from C:\Users\leonel\Desktop
Done.

Expected Behavior

I expect it create the folder project

Actual Behavior

Aborting installation.
Unexpected error. Please report it as a bug:
{ Error: Cannot find module 'C:\Users\leonel\Desktop\pseudogram\node_modules\react- scripts\package.json'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at checkNodeVersion (C:\Users\leonel\AppData\Roaming\npm\node_modules\create-re act-app\createReactApp.js:476:23)
at getPackageName.then.then.then.packageName (C:\Users\leonel\AppData\Roaming\n pm\node_modules\create-react-app\createReactApp.js:283:7)
at process._tickCallback (internal/process/next_tick.js:109:7) code: 'MODULE_NO T_FOUND' }

Deleting generated file... package.json
Deleting pseudogram / from C:\Users\leonel\Desktop
Done.

Arshaq1996 commented 5 years ago

F:\React-Lectures\Contact manger>npm install -g create-react-app 'npm' is not recognized as an internal or external command, operable program or batch file.

when i use this command on general cmd it is workin but when i came to folder after install npm globally write the command create-react-app my-app this error is occured 'npm' is not recognized as an internal or external command, operable program or batch file.