|
4 | 4 |
|
5 | 5 | 1. Read the error message carefully. The error message will tell you the precise key value
|
6 | 6 | that is not matching what Webpack expects.
|
7 |
| -2. Put a `debugger` statement in your Webpack configuration and run `bin/webpack --debug`. |
| 7 | +2. Put a `debugger` statement in your Webpack configuration and run `bin/webpack --debug`. |
8 | 8 | If you have a node debugger installed, you'll see the Chrome debugger for your webpack
|
9 |
| - config. For example, install the Chrome extension [NiM](https://chrome.google.com/webstore/detail/nodejs-v8-inspector-manag/gnhhdgbaldcilmgcpfddgdbkhjohddkj) and |
| 9 | + config. For example, install the Chrome extension [NiM](https://chrome.google.com/webstore/detail/nodejs-v8-inspector-manag/gnhhdgbaldcilmgcpfddgdbkhjohddkj) and |
10 | 10 | set the option for the dev tools to open automatically. For more details on debugging,
|
11 | 11 | see the official [Webpack docs on debugging](https://webpack.js.org/contribute/debugging/#devtools)
|
12 | 12 |
|
13 | 13 | ## ENOENT: no such file or directory - node-sass
|
14 | 14 |
|
15 |
| -* If you get this error `ENOENT: no such file or directory - node-sass` on Heroku |
16 |
| -or elsewhere during `assets:precompile` or `bundle exec rails webpacker:compile` |
17 |
| -then you would need to rebuild node-sass. It's a bit of a weird error; |
18 |
| -basically, it can't find the `node-sass` binary. |
19 |
| -An easy solution is to create a postinstall hook - `npm rebuild node-sass` in |
20 |
| -`package.json` and that will ensure `node-sass` is rebuilt whenever |
21 |
| -you install any new modules. |
| 15 | +If you get the error `ENOENT: no such file or directory - node-sass` on deploy with |
| 16 | +`assets:precompile` or `bundle exec rails webpacker:compile` you may need to |
| 17 | +move Sass to production `dependencies`. |
22 | 18 |
|
| 19 | +Move any packages that related to Sass (e.g. `node-sass` or `sass-loader`) from |
| 20 | +`devDependencies` to `dependencies` in `package.json`. This is because |
| 21 | +webpacker is running on a production system with the Rails workflow to build |
| 22 | +the assets. Particurly on hosting providers that try to detect and do the right |
| 23 | +thing, like Heroku. |
| 24 | + |
| 25 | +However, if you get this on local development, or not during a deploy then you |
| 26 | +may need to rebuild `node-sass`. It's a bit of a weird error; basically, it |
| 27 | +can't find the `node-sass` binary. An easy solution is to create a postinstall |
| 28 | +hook to ensure `node-sass` is rebuilt whenever new modules are installed. |
| 29 | + |
| 30 | +In `package.json`: |
| 31 | + |
| 32 | +```json |
| 33 | +"scripts": { |
| 34 | + "postinstall": "npm rebuild node-sass" |
| 35 | +} |
| 36 | +``` |
23 | 37 |
|
24 | 38 | ## Can't find hello_react.js in manifest.json
|
25 | 39 |
|
|
0 commit comments