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

CRA failing after unpacking all packages "Cannot find module 'universalify'" #4827

Closed
Mikhail-MM opened this issue Jul 27, 2018 · 1 comment

Comments

@Mikhail-MM
Copy link

Mikhail-MM commented Jul 27, 2018

Is this a bug report?

Yes.

Did you try recovering your dependencies?

(This is an issue with creating a new project, not an existing one)

Environment

Environment:
OS: Windows 10
Node: 8.11.3
Yarn: 1.7.0
npm: 5.2.0
Watchman: Not Found
Xcode: N/A
Android Studio: Not Found

ERROR: package.json not found!

Expected Behavior

running create-react-app <project-name> usually works to create a new boilerplate. something has been corrupted.

Actual Behavior

create-react-app downloads dependencies and extracts them. It looks like it is about to complete unpacking everything successfully, and then I receive this error:

Aborting installation.
Unexpected error. Please report it as a bug:
{ Error: Cannot find module 'universalify'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Users\mikem\Desktop\myapp\node_modules\fs-extra\lib\fs\index.js:3:11)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3) code: 'MODULE_NOT_FOUND' }

Before this, the typical output:

Creating a new React app in C:\Users\mikem\Desktop\myapp.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...

yarn add v1.7.0
info No lockfile found.
[1/4] Resolving packages...
warning react-scripts > autoprefixer > browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning react-scripts > babel-preset-react-app > babel-preset-env > browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning react-scripts > css-loader > cssnano > autoprefixer > browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning react-scripts > css-loader > cssnano > postcss-merge-rules > browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning react-scripts > css-loader > cssnano > postcss-merge-rules > caniuse-api > browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning react-scripts > jest > jest-cli > istanbul-api > istanbul-lib-hook@1.2.1: 1.2.0 should have been a major version bump
[2/4] Fetching packages...
info fsevents@1.2.4: The platform "win32" is incompatible with this module.
info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 728 new dependencies.
info Direct dependencies
├─ react-dom@16.4.1
├─ react-scripts@1.1.4
└─ react@16.4.1
info All dependencies
...

HOWEVER - I was able to get CRA working with the following command, found in this issue:
#4311

When I use this command:
npx -p create-react-app -c "create-react-app my-app --use-npm"
CRA successfully creates a new project.

Another problem: When I flip the flag to --use-yarn, this bug reappears, and the CRA aborts because it can not find that universalify module.

Before I found that command, I tried to use npx and ran into an installation issue where it could not resolve Path.

npx create-react-app my-app
npx: installed 1 in 1.92s
Path must be a string. Received undefined
null
module.js:549
    throw err;
    ^

Error: Cannot find module 'commander'
    at Function.Module._resolveFilename (module.js:547:15)
 
...

I had to make sure my Environment Variables of PATH looked like this in the Windows Environment Variable editor. This issue is related: zkat/npx#144

User
AppData\npm

System
AppData\npm
ProgramFiles\nodejs

I noticed that before I did this, npx was using an older version even though I updated it to the latest using npm. The new updated version was in AppData, and older version housed in ProgramFiles/nodejs. I had the order of system variables reversed, so that the older npx was being run from Program Files.
Example:

// Before
where npx
C:\Program Files\nodejs\npx
C:\Program Files\nodejs\npx.cmd
C:\Users\mikem\AppData\Roaming\npm\npx
C:\Users\mikem\AppData\Roaming\npm\npx.cmd

// After System Variables Edited
// Path Resolves Successfully
where npx
C:\Users\mikem\AppData\Roaming\npm\npx
C:\Users\mikem\AppData\Roaming\npm\npx.cmd
C:\Program Files\nodejs\npx
C:\Program Files\nodejs\npx.cmd

I am not sure why this is happening, can someone point me to the right direction? I have tried uninstalling and re-installing CRA, re-installing node, going back to npm v 5.2.0, repairing my yarn installation, but something is corrupted. Thank you for any help and I'm sorry if this bug report was disorganized.

Reproducible Demo

(I do not know how to reproduce this environment)

@Mikhail-MM Mikhail-MM changed the title CRA failing after building all packages "Cannot find module 'universalify'" CRA failing after unpacking all packages "Cannot find module 'universalify'" Jul 27, 2018
@Mikhail-MM
Copy link
Author

Sorry, I think I have fixed this by just running yarn cache clean. Hopefully...

@lock lock bot locked and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant