Closed
Milestone
Description
Is this a bug report?
yes
Did you try recovering your dependencies?
yes
Which terms did you search for in User Guide?
"Updating to New Releases", "Migrating from 2.0.0-next.xyz"
Environment
(paste the output of the command here)
faild to run create-react-app --info
Environment:
OS: Windows 10
Node: 8.11.4
Yarn: 1.5.4
npm: 5.6.0
Watchman: Not Found
Xcode: N/A
Android Studio: Not Found
Packages: (wanted => installed)
react: ^16.5.2 => 16.5.2
react-dom: ^16.5.2 => 16.5.2
react-scripts: 2.0.0-next.a671462c => 2.0.0
Steps to Reproduce
(Write your steps here:)
- init project with react-scripts@2.0.0-next.a671462c
$ create-react-app app --scripts-version 2.0.0-next.a671462c- add dva and modify
src/index.js
$ cd app
$ yarn add dva// src/index.js
import React from 'react';
import dva from 'dva';
import createHistory from 'history/createHashHistory';
// 1. Initialize
const app = dva({
history: createHistory(),
});
// 2. Plugins
// app.use({});
// 3. Register global model
// app.model(require('../models/index').default);
// 4. Router
app.router(() => <div>Test</div>);
// 5. Start
app.start('#root');- The project can be successfully started
$ yarn start
yarn run v1.5.1
$ react-scripts start
Starting the development server...
Compiled successfully!
You can now view app in the browser.
Local: http://localhost:3000/
On Your Network: http://192.168.30.22:3000/
Note that the development build is not optimized.
To create a production build, use yarn build.- update react-scripts to 2.0.0, project can not work any more.
$ yarn add --exact react-scripts@2.0.0
$ yarn start
yarn run v1.5.1
$ react-scripts start
Starting the development server...
Failed to compile.
./node_modules/dva-core/lib/index.js
Module not found: Can't resolve '@babel/runtime/core-js/get-iterator' in 'D:\git
hub\app\node_modules\dva-core\lib'
Compiling...
Failed to compile.
./node_modules/dva-core/lib/index.js
Module not found: Can't resolve '@babel/runtime/core-js/get-iterator' in 'D:\git
hub\app\node_modules\dva-core\lib'
Expected Behavior
(Write what you thought would happen.)

Actual Behavior
(Write what happened. Please add screenshots!)

Reproducible Demo
(Paste the link to an example project and exact instructions to reproduce the issue.)
https://github.com/goblin-laboratory/cra/tree/demo
Activity
[-]project can not work after update react-scripts form 2.0.0-next.a671462c to 2.0.0[/-][+]project can not work after upgrade react-scripts form 2.0.0-next.a671462c to 2.0.0[/+]gaearon commentedon Sep 27, 2018
Similar issue: #5103 (comment)
Timer commentedon Sep 27, 2018
Here's my findings thus far:
Since there are two versions of
@babel/runtime, one gets hoisted and the other sits next toreact-scripts:(note:
dva's is at root,react-scripts's is next to it)webpack is set to look at
node_modules, which I assume means it looks atreact-scripts'snode_modulesinstead of starting at thedvalevel.https://github.com/facebook/create-react-app/blob/a73829ffa6c820cd046ba21e5c3cab671edb74ea/packages/react-scripts/config/webpack.config.prod.js#L185-L193
x-ref: webpack/webpack#6505 (comment)
I make this assumption because the module missing is with
react-scripts's version, notdva's version:So, it appears our module resolution is searching in the wrong place, not starting at the level of the project it's currently resolved to.
Timer commentedon Sep 28, 2018
react-scripts@2.0.1is out. Please upgrade your dependencies and see if this is fixed.henkvhest commentedon Sep 28, 2018
My issue in #5103 (comment) is now solved with 2.0.1
xiaosongxiaosong commentedon Sep 29, 2018
It has been fixed by upgrade react-scripts to 2.0.1.