You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/react-scripts/template/README.md
+21-1
Original file line number
Diff line number
Diff line change
@@ -65,6 +65,7 @@ You can find the most recent version of this guide [here](https://github.com/fac
65
65
-[Troubleshooting](#troubleshooting)
66
66
-[`npm test` hangs on macOS Sierra](#npm-test-hangs-on-macos-sierra)
67
67
-[`npm run build` silently fails](#npm-run-build-silently-fails)
68
+
-[`npm run build` fails on Heroku](#npm-run-build-fails-on-heroku)
68
69
-[Something Missing?](#something-missing)
69
70
70
71
## Updating to New Releases
@@ -1176,7 +1177,21 @@ GitHub Pages doesn't support routers that use the HTML5 `pushState` history API
1176
1177
### Heroku
1177
1178
1178
1179
Use the [Heroku Buildpack for Create React App](https://github.com/mars/create-react-app-buildpack).<br>
1179
-
You can find instructions in [Deploying React with Zero Configuration](https://blog.heroku.com/deploying-react-with-zero-configuration).
1180
+
You can find instructions in [Deploying React with Zero Configuration](https://blog.heroku.com/deploying-react-with-zero-configuration).
1181
+
1182
+
#### Resolving "Module not found: Error: Cannot resolve 'file' or 'directory'"
1183
+
1184
+
Sometimes `npm run build` works locally but fails during deploy via Heroku with an error like this:
1185
+
1186
+
```
1187
+
remote: Failed to create a production build. Reason:
1188
+
remote: Module not found: Error: Cannot resolve 'file' or 'directory'
1189
+
MyDirectory in /tmp/build_1234/src
1190
+
```
1191
+
1192
+
This means you need to ensure that the lettercase of the file or directory you `import` matches the one you see on your filesystem or on GitHub.
1193
+
1194
+
This is important because Linux (the operating system used by Heroku) is case sensitive. So `MyDirectory` and `mydirectory` are two distinct directories and thus, even though the project builds locally, the difference in case breaks the `import` statements on Heroku remotes.
1180
1195
1181
1196
### Modulus
1182
1197
@@ -1270,6 +1285,11 @@ There are also reports that *uninstalling* Watchman fixes the issue. So if nothi
1270
1285
1271
1286
It is reported that `npm run build` can fail on machines with no swap space, which is common in cloud environments. If [the symptoms are matching](https://github.com/facebookincubator/create-react-app/issues/1133#issuecomment-264612171), consider adding some swap space to the machine you’re building on, or build the project locally.
1272
1287
1288
+
### `npm run build` fails on Heroku
1289
+
1290
+
This may be a problem with case sensitive filenames.
1291
+
Please refer to [this section](#resolving-module-not-found-error-cannot-resolve-file-or-directory).
1292
+
1273
1293
## Something Missing?
1274
1294
1275
1295
If you have ideas for more “How To” recipes that should be on this page, [let us know](https://github.com/facebookincubator/create-react-app/issues) or [contribute some!](https://github.com/facebookincubator/create-react-app/edit/master/packages/react-scripts/template/README.md)
0 commit comments