create-react-app: Unexpected error upon creating a new Project

Is this a bug report?

Yes

Did you try recovering your dependencies?

No, everything is up-to-date, and it is a NEW project.

Which terms did you search for in User Guide?

None, since it is a “start” of a project.

Environment

  1. node -v: v8.9.4
  2. npm -v: 5.6.0
  3. yarn --version (if you use Yarn): 1.6.0
  4. npm ls react-scripts (if you haven’t ejected): `-- (empty)

Then, specify:

  1. Operating system: Windows 10
  2. Browser and version (if relevant): N/R

Steps to Reproduce

(Write your steps here:)

  1. Install Node/NPM
  2. Install create-react-app (npm install -g create-react-app)
  3. Create a new Project (create-react-app dashboard)

Expected Behavior

Create a new Folder with the project inside.

Actual Behavior

source $ create-react-app dashboard

Creating a new React app in ~\Projects\test\source\dashboard.

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

yarn add v1.6.0
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[###########################################################################################################################################################] 1113/1114 Aborting installation.
Unexpected error. Please report it as a bug:
{ Error: Cannot find module '~\Projects\test\source\dashboard\node_modules\react-scripts\package.json'
    at Function.Module._resolveFilename (module.js:538:15)
    at Function.Module._load (module.js:468:25)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at checkNodeVersion (~\scoop\persist\nodejs\bin\node_modules\create-react-app\createReactApp.js:514:23)
    at getPackageName.then.then.then.packageName (~\scoop\persist\nodejs\bin\node_modules\create-react-app\createReactApp.js:312:7)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7) code: 'MODULE_NOT_FOUND' }

Deleting generated file... package.json
Deleting dashboard / from ~\Projects\test\source
Done.
source $

Reproducible Demo

Since there is no way to create the Project, it is not possible to build a “demo”.

Thanks in advance, and keep up the amazing work!

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (6 by maintainers)

Most upvoted comments

I see. Maybe worth trying to test with Scoop specifically. I can give it a try to reproduce some time later this or next week.

If you run with --use-npm, does the problem persist?

I see. Maybe worth trying to test with Scoop specifically. I can give it a try to reproduce some time later this or next week. If you run with --use-npm, does the problem persist?

I had the same issue but create-react-app dashboard --use-npm helped me, is this a real solution for this issue?

@jaisonjjames it is a real solution, but keep in mind you are forcing the tool to use NPM instead of Yarn.

For me, the solutions was “not to use” the official Yarn (from Scoop), and instead use the NPM repo Yarn. (as I said, I’m not able to understand what could be different, I don’t have the knowledge to)

Removed yarn from Scoop.

source $ scoop uninstall yarn
Uninstalling 'yarn' (1.6.0).
Unlinking ~\scoop\apps\yarn\current
Removing ~\scoop\apps\yarn\current\bin from your path.
Removing ~\scoop\apps\yarn\current\Yarn\bin from your path.
Removing older version (1.3.2).
Removing older version (1.5.1).
'yarn' was uninstalled.

Installed with npm

source $ npm install -g yarn
~\scoop\persist\nodejs\bin\yarn -> ~\scoop\persist\nodejs\bin\node_modules\yarn\bin\yarn.js
~\scoop\persist\nodejs\bin\yarnpkg -> ~\scoop\persist\nodejs\bin\node_modules\yarn\bin\yarn.js
+ yarn@1.6.0
added 1 package in 1.846s

Everything went fine:

source $ create-react-app dashboard-yarn

Creating a new React app in ~\Projects\test\source\dashboard-yarn.

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

yarn add v1.6.0
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.1.3: The platform "win32" is incompatible with this module.
info "fsevents@1.1.3" 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 734 new dependencies.
info Direct dependencies
├─ react-dom@16.3.2
├─ ...
└─ react@16.3.2
info All dependencies
├─ abab@1.0.4
├─ ...
└─ yargs-parser@5.0.0
Done in 269.44s.

Success! Created dashboard-yarn at ~\Projects\test\source\dashboard-yarn
Inside that directory, you can run several commands:

  yarn start
    Starts the development server.

  yarn build
    Bundles the app into static files for production.

  yarn test
    Starts the test runner.

  yarn eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

  cd dashboard-yarn
  yarn start

Happy hacking!

@gaearon Running with --use-npm succeeded.

Maybe it is an issue with yarn (installed with Scoop). I’ll try and install it from npm, and get back to you ASAP.

source $ create-react-app dashboard --use-npm

Creating a new React app in ~\Projects\test\source\dashboard.

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


> uglifyjs-webpack-plugin@0.4.6 postinstall ~\Projects\test\source\dashboard\node_modules\uglifyjs-webpack-plugin
> node lib/post_install.js

+ react-scripts@1.1.4
+ react-dom@16.3.2
+ react@16.3.2
added 1317 packages in 301.936s

Success! Created dashboard at ~\Projects\test\source\dashboard
Inside that directory, you can run several commands:

  npm start
    Starts the development server.

  npm run build
    Bundles the app into static files for production.

  npm test
    Starts the test runner.

  npm run eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

  cd dashboard
  npm start

Happy hacking!