Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when creating a new project #2751

Closed
SeanBannister opened this issue Jul 9, 2017 · 9 comments
Closed

Error when creating a new project #2751

SeanBannister opened this issue Jul 9, 2017 · 9 comments

Comments

@SeanBannister
Copy link

SeanBannister commented Jul 9, 2017

Is this a bug report?

Yes

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

This bug is not reproducible with NPM. It only affects create-react-app when Yarn is installed.

Environment

  1. node -v: 6.11.0

  2. npm -v: 4.6.1

  3. yarn --version:
    Tested with:
    0.27.5
    0.26.0
    0.25.1

  4. npm ls react-scripts: Not applicable, doesn't get this far to check.

  5. Operating system:
    Windows 8.1 Pro

Steps to Reproduce

  1. Install create-react-app npm install -g create-react-app
  2. Install yarn via the windows .msi file.
  3. Open command prompt and run: create-react-app myapp

Expected Behavior

New project is created.

Actual Behavior

The following error is encountered.

Aborting installation.
Unexpected error. Please report it as a bug:
{ Error: Cannot find module 'L:\myapp\node_modules\react-scripts\scripts\init.js'
    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 getPackageName.then.then.then.packageName (C:\Users\Sean\AppData\Roaming\npm\node_modules\create-react-app\createReactApp.js:298:20)
    at process._tickCallback (internal/process/next_tick.js:109:7) code: 'MODULE_NOT_FOUND' }

Full output from the command line here.

As mentioned above this only happens when Yarn is installed and therefore create-react-app uses it for creating the project. If I uninstall Yarn the process completes successfully with NPM.

I'm looking for guidance on how I should attempt to debug this. This might end up being a Yarn issue.

@gaearon
Copy link
Contributor

gaearon commented Jul 9, 2017

Install create-react-app 1.3.3 via the Windows .msi file.

I didn't fully get that part. Where did you find this .msi file?

@SeanBannister
Copy link
Author

Sorry I clearly wasn't thinking when I typed that, here's what I meant to write:

Steps to Reproduce

  1. Install create-react-app npm install -g create-react-app
  2. Install yarn via the windows .msi file.
  3. Open command prompt and run: create-react-app myapp

@gaearon
Copy link
Contributor

gaearon commented Jul 9, 2017

I’d appreciate if you could cross-post this in Yarn repo.
I don’t think it’s a bug on our side, but we’ll want to keep track of it.

@jeredmasters
Copy link

jeredmasters commented Aug 1, 2017

I get this same error without yarn
[email protected]
[email protected]
[email protected]
Windows 10, fresh install
Npm 3.10.10
Node 6.11.1

npm install -g create-react-app
create-react-app testapp
Aborting installation.
Unexpected error. Please report it as a bug:
{ Error: Cannot find module 'C:\Users\jered\Documents\Projects\react\testapp\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\jered\AppData\Roaming\npm\node_modules\create-react-app\createReactApp.js:479:23)
    at getPackageName.then.then.then.packageName (C:\Users\jered\AppData\Roaming\npm\node_modules\create-react-app\createReactApp.js:288:7)
    at process._tickCallback (internal/process/next_tick.js:109:7) code: 'MODULE_NOT_FOUND' }```

@andywillis
Copy link

@gaearon , I'm getting this error with npm v3/4/5 (node v6 and 8), and yarn (npm uninstalled), Windows 7 x64. At first I thought it was an issue with my network connection, or a problem with npm, or my virus checker, but npm/yarn will quite happily install something like preact-cli without any problems. It's got me completely foxed because it worked fine in the past.

It never aborts in the same place in the installation, but it's always the same error:

Aborting installation.
Unexpected error. Please report it as a bug:
{ Error: Cannot find module 'C:\Users\XXX\Development\WIP\newapp\node_modules\react-scripts\package.json'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at checkNodeVersion (C:\Users\XXX\AppData\Roaming\npm\node_modules\create-react-app\createReactApp.js:476:23)
    at getPackageName.then.then.then.packageName (C:\Users\XXX\AppData\Roaming\npm\node_modules\create-react-app\createReactApp.js:285:7)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7) code: 'MODULE_NOT_FOUND' }

@Timer
Copy link
Contributor

Timer commented Aug 9, 2017

Can you try clearing your npm and Yarn cache?

@andywillis
Copy link

Yes. I tried that too. Same error, but this time it aborted immediately instead of running through a few packages first.

Andy@Home MINGW64 ~/Development/WIP                                                                                         
$ npm cache clear                                                                                                           
                                                                                                                            
Andy@Home MINGW64 ~/Development/WIP                                                                                         
$ create-react-app newapp                                                                                                   
                                                                                                                            
Creating a new React app in C:\Users\Andy\Development\WIP\newapp.                                                           
                                                                                                                            
Installing packages. This might take a couple of minutes.                                                                   
Installing react, react-dom, and react-scripts...                                                                           
                                                                                                                            
[..................] | loadRequestedDeps: verb cache add spec react-dom                                                     
Aborting installation.                                                                                                      
Unexpected error. Please report it as a bug:                                                                                
{ Error: Cannot find module 'C:\Users\Andy\Development\WIP\newapp\node_modules\react-scripts\package.json'                  
    at Function.Module._resolveFilename (module.js:485:15)                                                                  
    at Function.Module._load (module.js:437:25)                                                                             
    at Module.require (module.js:513:17)                                                                                    
    at require (internal/module.js:11:18)                                                                                   
    at checkNodeVersion (C:\Users\Andy\AppData\Roaming\npm\node_modules\create-react-app\createReactApp.js:476:23)          
    at getPackageName.then.then.then.packageName (C:\Users\Andy\AppData\Roaming\npm\node_modules\create-react-app\createReac
tApp.js:285:7)                                                                                                              
    at <anonymous>                                                                                                          
    at process._tickCallback (internal/process/next_tick.js:188:7) code: 'MODULE_NOT_FOUND' }                               

@lifehome
Copy link

lifehome commented Dec 2, 2017

I am also seeing this, can reproduce the bug through @andywillis steps.

Note: yarn is not installed.

To reproduce:

  1. npm cache clear
  2. npm i -g create-react-app
  3. cd ~/workspace
  4. create-react-app myapp
  5. The following happens both thru terminal and WebStorm...
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and 1.0...

+ [email protected]
+ [email protected]
+ [email protected]
added 208 packages in 19.886s

Aborting installation.
Unexpected error. Please report it as a bug:
{ Error: Cannot find module '/Users/lifehome/WebstormProjects/untitled/node_modules/1.0/scripts/init.js'
    at Function.Module._resolveFilename (module.js:536:15)
    at Function.Module._load (module.js:466:25)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at getPackageName.then.then.then.packageName (/usr/local/lib/node_modules/create-react-app/createReactApp.js:305:20)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7) code: 'MODULE_NOT_FOUND' }

Deleting generated file... node_modules
Deleting generated file... package.json
Done.
Done

@gaearon
Copy link
Contributor

gaearon commented Jan 8, 2018

We can't help more since the error is so transient. It might be caused by a buggy npm or Yarn version, a bad npm registry proxy, a bad internet connection, etc.

@gaearon gaearon closed this as completed Jan 8, 2018
@lock lock bot locked and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants