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

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.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 51 (24 by maintainers)

Most upvoted comments

Do you remember setting this key? 😛

I thought Projects looked suspicious (it is not special for the OS, and is not a parent directory of your projects judging by the log) so I thought maybe you tried to make your shell always start in this directory, and followed a bad tutorial that messed up your system.

I googled “how to change default terminal directory on windows” which led me to this answer with a scary “it can also really mess things up” disclaimer about the other answer.

That link led me to this blog entry describing the problem: https://blogs.msdn.microsoft.com/oldnewthing/20071121-00/?p=24433/ (it’s a good blog in general btw).

Please run:

reg delete "HKLM\Software\Microsoft\Command Processor" /v AutoRun /f
reg delete "HKCU\Software\Microsoft\Command Processor" /v AutoRun /f

and then try creating an app again.

More than I care to know.

@gaearon you just got way too familiar with Windows internals 😆