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

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): react-scripts@0.8.1
  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 react-scripts@0.7.0
$ now

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 17 (8 by maintainers)

Most upvoted comments

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

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… ¯\_(ツ)_/¯

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!