Create-react-app: Zeit `now` deploys fail after version 0.7.0.

Created on 7 Dec 2016  ·  17Comments  ·  Source: facebook/create-react-app

I'm not sure if this is related to now, but since upgrading react-scripts to anything above 0.7.0, my build is now failing on the now deployment.

Here are the logs:

> ▲ npm run build
>
>   - index.js:47 Compiler.<anonymous>
>     [src]/[b6a523076d54485fee7b51e624a717feb64ba053]/index.js:47:40
>
> Error Error: Command react-scripts build ended with code 1
>     at ChildProcess.<anonymous> (/usr/lib/node_modules/@zeit/ace/build/lib/run.js:1:599)
>     at emitTwo (events.js:106:13)
>     at ChildProcess.emit (events.js:191:7)
>     at maybeClose (internal/child_process.js:877:16)
>     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

And the webpack file error that's being served:

TypeError: Cannot read property '0' of undefined

  - ExternalModuleFactoryPlugin.js:18 ExternalModuleFactoryPlugin.
    [src]/[6b8981c7f0f59e57253f8dd5b1728ea3f444414d]/lib/ExternalModuleFactoryPl    ugin.js:18:38

  - NormalModuleFactory.js:159 
    [src]/[0a79c0ca287eb47d24f1da61b5f91b43ad6b29d8]/lib/NormalModuleFactory.js:    159:3

  - Tapable.js:75 NormalModuleFactory.applyPluginsAsyncWaterfall
    [src]/[83d7d57e3d1ba8fe04c1aff2eddd6e9eb2c9743c]/lib/Tapable.js:75:69

  - NormalModuleFactory.js:144 NormalModuleFactory.create
    [src]/[0a79c0ca287eb47d24f1da61b5f91b43ad6b29d8]/lib/NormalModuleFactory.js:    144:8

  - Compilation.js:356 Compilation.process [as _addModuleChain]
    [src]/[0a79c0ca287eb47d24f1da61b5f91b43ad6b29d8]/lib/Compilation.js:356:16

  - Compilation.js:424 Compilation.process [as addEntry]
    [src]/[0a79c0ca287eb47d24f1da61b5f91b43ad6b29d8]/lib/Compilation.js:424:7

  - SingleEntryPlugin.js:22 SingleEntryPlugin.
    [src]/[6b8981c7f0f59e57253f8dd5b1728ea3f444414d]/lib/SingleEntryPlugin.js:22    :15

  - Tapable.js:107 Compiler.applyPluginsParallel
    [src]/[83d7d57e3d1ba8fe04c1aff2eddd6e9eb2c9743c]/lib/Tapable.js:107:14

  - Compiler.js:394 Compiler.compile
    [src]/[0a79c0ca287eb47d24f1da61b5f91b43ad6b29d8]/lib/Compiler.js:394:7

  - Compiler.js:203 Compiler.runAsChild
    [src]/[0a79c0ca287eb47d24f1da61b5f91b43ad6b29d8]/lib/Compiler.js:203:7

  - compiler.js:70 
    [src]/[b6a523076d54485fee7b51e624a717feb64ba053]/lib/compiler.js:70:19

  - debuggability.js:299 Promise._execute
    [src]/[953ea8d4badc1212d26071638946cd40c7f53f6b]/js/release/debuggability.js    :299:9

  - promise.js:481 Promise._resolveFromExecutor
    [src]/[953ea8d4badc1212d26071638946cd40c7f53f6b]/js/release/promise.js:481:1    8

  - promise.js:77 new Promise
    [src]/[953ea8d4badc1212d26071638946cd40c7f53f6b]/js/release/promise.js:77:14  
  - compiler.js:69 Object.compileTemplate
    [src]/[b6a523076d54485fee7b51e624a717feb64ba053]/lib/compiler.js:69:10

  - index.js:47 Compiler.
    [src]/[b6a523076d54485fee7b51e624a717feb64ba053]/index.js:47:40

These are as good of logs I can get right now unless there's a more verbose logging in react-scripts build.

This may be a Zeit now issue, but the fact that it worked prior to 0.8.x makes me want to bring it up here.

Environment

  1. npm ls react-scripts (if you haven’t ejected): [email protected]
  2. node -v: v7.1.0 or v7.0.0
  3. npm -v: 3.10.9
  4. yarn --version: 0.17.4
  5. now --version: 𝚫 now 0.35.0
  6. package.json: (note "list" and "now-start")
{
  "name": "example",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "react-scripts": "0.8.1"
  },
  "dependencies": {
    "list": "^0.9.0",
    "react": "^15.4.1",
    "react-dom": "^15.4.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
    "now-start": "list ./build --single"
  }
}

How to reproduce

$ create-react-app example
$ yarn add list
$ ... add "now-start": "list ./build --single" to scripts
$ cd example
$ now

Now to make it actually work

$ yarn upgrade [email protected]
$ now
bug underlying tools

Most helpful comment

Apologies for the delay with the fix, the underlying issue in now has been fixed and react-create-apps seems to be building properly in now

Demo/poc app here: https://react-create-app-demo-zqahqhmybz.now.sh/
and src here: https://react-create-app-demo-zqahqhmybz.now.sh/_src/?f=package.json

All 17 comments

Does npm run build work?

Can you provide a project and an exact sequence of steps to reproduce this?

@gaearon Hey, I just updated with the steps. I went through them 1 by 1 again and they are accurate.

@j

Can you please reply to:

Does npm run build work?

@gaearon yes, "npm run build" works.. However, with Zeit, I can't log into their environment to run that command.

I've tried using USE_YARN=no, removing the yarn.lock file, hardcoding the userYarn to be false, just to see if it's because now doesn't have yarn support yet. I'm able to get this version to work when deploying a Dockerfile to now. Just not with their node support. I'm not sure which side the issue belongs to.

I know they are looking into it also.

If npm run build works it's likely not on our side.

The fact that I can roll back to 0.7.0, it made me believe something happened here.

It could be relying on some private API or implementation detail.
Could be our fault, too.
Let’s keep it open here but we’ll need somebody to respond on their side.

Right on. I tried digging into it line by line, but I'm unable to get the full output of what's going on on the now instance because once the build fails, it ends up serving the broken webpack error which isn't helpful.

Thanks!

Just wanted to voice a +1 here, same thing happens to me as well. Interested to see how this could be resolved.

Same problem here:

```
Html Webpack Plugin:
TypeError: Cannot read property '0' of undefined

  • ExternalModuleFactoryPlugin.js:18 ExternalModuleFactoryPlugin.
    [src]/[6b8981c7f0f59e57253f8dd5b1728ea3f444414d]/lib/ExternalModuleFactoryPl ugin.js:18:38

  • NormalModuleFactory.js:159
    [src]/[2f29e5542c7b2eaf895a8e435bde063c6e9eba0d]/lib/NormalModuleFactory.js: 159:3

  • Tapable.js:75 NormalModuleFactory.applyPluginsAsyncWaterfall
    [src]/[83d7d57e3d1ba8fe04c1aff2eddd6e9eb2c9743c]/lib/Tapable.js:75:69

  • NormalModuleFactory.js:144 NormalModuleFactory.create
    [src]/[2f29e5542c7b2eaf895a8e435bde063c6e9eba0d]/lib/NormalModuleFactory.js: 144:8

  • Compilation.js:356 Compilation.process [as _addModuleChain]
    [src]/[2f29e5542c7b2eaf895a8e435bde063c6e9eba0d]/lib/Compilation.js:356:16

  • Compilation.js:424 Compilation.process [as addEntry]
    [src]/[2f29e5542c7b2eaf895a8e435bde063c6e9eba0d]/lib/Compilation.js:424:7

  • SingleEntryPlugin.js:22 SingleEntryPlugin.
    [src]/[6b8981c7f0f59e57253f8dd5b1728ea3f444414d]/lib/SingleEntryPlugin.js:22 :15

  • Tapable.js:107 Compiler.applyPluginsParallel
    [src]/[83d7d57e3d1ba8fe04c1aff2eddd6e9eb2c9743c]/lib/Tapable.js:107:14

  • Compiler.js:394 Compiler.compile
    [src]/[2f29e5542c7b2eaf895a8e435bde063c6e9eba0d]/lib/Compiler.js:394:7

  • Compiler.js:203 Compiler.runAsChild
    [src]/[2f29e5542c7b2eaf895a8e435bde063c6e9eba0d]/lib/Compiler.js:203:7

  • compiler.js:70
    [src]/[b6a523076d54485fee7b51e624a717feb64ba053]/lib/compiler.js:70:19

  • debuggability.js:299 Promise._execute
    [src]/[953ea8d4badc1212d26071638946cd40c7f53f6b]/js/release/debuggability.js :299:9

  • promise.js:481 Promise._resolveFromExecutor
    [src]/[953ea8d4badc1212d26071638946cd40c7f53f6b]/js/release/promise.js:481:1 8

  • promise.js:77 new Promise
    [src]/[953ea8d4badc1212d26071638946cd40c7f53f6b]/js/release/promise.js:77:14

  • compiler.js:69 Object.compileTemplate
    [src]/[b6a523076d54485fee7b51e624a717feb64ba053]/lib/compiler.js:69:10

  • index.js:47 Compiler.
    [src]/[b6a523076d54485fee7b51e624a717feb64ba053]/index.js:47:40
    ```

Apologies for the delay with the fix, the underlying issue in now has been fixed and react-create-apps seems to be building properly in now

Demo/poc app here: https://react-create-app-demo-zqahqhmybz.now.sh/
and src here: https://react-create-app-demo-zqahqhmybz.now.sh/_src/?f=package.json

Sounds great!

Just started to get this issue, however I do not use now.sh. Both yarn build/start and npm run build/start produce the same error. Downgrading to 0.7.0 fixes the issue. I tried 0.8.0, and that gave me the same error. Only thing I did between a working build and a non-working build was to add css-loader and style-loader to my dev-dependencies for my server code, which I have since removed, but the error remains.

Tried all the normal stuff, deleted node_modules and the yarn cache. Unsure of what to try next.

EDIT: just tried downgrading to webpack 1 for my server code. Was then able to upgrade back to latest react-scripts and everything worked. Then went ahead and upgraded to latest webpack 2, and everything still works. So...... ¯\_(ツ)_/¯

Thanks for the tips @vidarc. I also experienced a similar issue after making some package changes – a mix of add and remove from both dependencies and devDependencies. I'm not using now either. I was able to get past this with:

$ rm -rf node_modules
$ rm yarn.lock
$ yarn cache clean
$ yarn install
Was this page helpful?
0 / 5 - 0 ratings

Related issues

oltsa picture oltsa  ·  3Comments

DaveLindberg picture DaveLindberg  ·  3Comments

alleroux picture alleroux  ·  3Comments

onelson picture onelson  ·  3Comments

barcher picture barcher  ·  3Comments