Create-react-app: Cannot find module 'babel-loader' after eject

Created on 10 May 2018  路  10Comments  路  Source: facebook/create-react-app

Is this a bug report?

Yes

Environment

OS: Mac os X 10.13.4
Node: v10.1.0/v9.11.1
yarn: v1.6.0
create-react-app: v1.5.2
react-scripts: v1.1.4

Description:

After running create-react-app my-app, yarn start works just fine. However after running yarn run eject and type yarn start again, the issue pumps out below:

yarn run v1.6.0
$ node scripts/start.js
internal/modules/cjs/loader.js:550
    throw err;
    ^

Error: Cannot find module 'babel-loader'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:548:15)
    at Function.resolve (internal/modules/cjs/helpers.js:18:19)
    at Object.<anonymous> (/Users/norn/Desktop/my-app-9/config/webpack.config.dev.js:145:29)
    at Module._compile (internal/modules/cjs/loader.js:654:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Module.require (internal/modules/cjs/loader.js:598:17)
    at require (internal/modules/cjs/helpers.js:11:18)
    at Object.<anonymous> (/Users/norn/Desktop/my-app-9/scripts/start.js:31:16)
    at Module._compile (internal/modules/cjs/loader.js:654:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

2018-05-10 5 04 05

Also, react-app-rewired directly fails when use command yarn start, due to the same issue described above.


Most helpful comment

A simple fix to that just install 'babel-loader' again by typing yarn add babel-loader on your terminal

All 10 comments

Hey guys I find out this could be a bug which relates to yarnpkg itself.

It seems that yarn does not install babel-loader which couldn't be found in node_modules directory, however if the version of yarn is prior to 1.0.0 babel-loader would be installed properly.

A simple fix to that just install 'babel-loader' again by typing yarn add babel-loader on your terminal

@daresam Yeah I manually install babel-loader as well, being my temporary solution. I've opened an issue on yarn and see if they can figure it out and handle it.

Closing because the issue is with a package manager.

I've just faced the exact same issue but I'm using npm as my package manager.
update: I installed yarn and I'm still having the issue there. Although It can be solved by installing 'babel-loader' manually

I am having the same issue.

for people having this problem, just run yarn/npm install after ejecting and it should be fine, some dependencies after ejection seens to be missing.

I have faced same issue when I run the command> npm run eject, but I've solved this issue by run this command> yarn add babel-loader@7.

I installed babel-loader, but I keep getting the same issue? What else could be a problem?

@rades12340 try npm/yarn install !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wereHamster picture wereHamster  路  3Comments

xgqfrms-GitHub picture xgqfrms-GitHub  路  3Comments

alleroux picture alleroux  路  3Comments

barcher picture barcher  路  3Comments

onelson picture onelson  路  3Comments