New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev server crashes when file is renamed #1157

Closed
ArthurClemens opened this Issue Sep 13, 2017 · 2 comments

Comments

Projects
None yet
3 participants
@ArthurClemens
Contributor

ArthurClemens commented Sep 13, 2017

On OS X, watchman 4.7.0, I get a crash whenever a data file is renamed:

ERROR in ./src/structure/urls.js
Module not found: Error: Can't resolve 'content/structure/navigation.yml' in '/Users/me/code/Go/src/github.com/Client/www/frontend/packages/project-www-website/src/structure'
 @ ./src/structure/urls.js 14:18-61
 @ ./src/structure/Routes.js
 @ ./src/index.js
 @ multi (webpack)-hot-middleware/client.js ./~/react-hot-loader/patch.js ./src/index.js
webpack: Failed to compile.
events.js:160
      throw er; // Unhandled 'error' event
      ^

TypeError: Cannot read property 'name' of undefined
    at /Users/me/code/Go/src/github.com/Client/www/frontend/packages/project-www-website/node_modules/@phenomic/core/lib/watch/index.js:120:18
    at Array.find (native)
    at WatchmanWatcher.<anonymous> (/Users/me/code/Go/src/github.com/Client/www/frontend/packages/project-www-website/node_modules/@phenomic/core/lib/watch/index.js:119:23)
    at emitThree (events.js:116:13)
    at WatchmanWatcher.emit (events.js:194:7)
    at WatchmanWatcher.emitEvent (/Users/me/code/Go/src/github.com/Client/www/frontend/packages/project-www-website/node_modules/sane/src/watchman_watcher.js:266:8)
    at WatchmanWatcher.handleFileChange (/Users/me/code/Go/src/github.com/Client/www/frontend/packages/project-www-website/node_modules/sane/src/watchman_watcher.js:227:10)
    at Array.forEach (native)
    at WatchmanWatcher.handleChangeEvent (/Users/me/code/Go/src/github.com/Client/www/frontend/packages/project-www-website/node_modules/sane/src/watchman_watcher.js:189:16)
    at emitOne (events.js:96:13)
    at Client.emit (events.js:188:7)
error Command failed with exit code 1.

@MoOx MoOx added the bug label Sep 15, 2017

@marcelorl

This comment has been minimized.

marcelorl commented Oct 1, 2017

I think this is not about setup, this is more about how hot-reloading works. It crashes if you change a file name, yes.

But there is a way to avoid crashing, you could first change the file path require in every file which requires this to-be-changed one. Theeen, you change the file name.

Not a bug I guess.

@MoOx @ArthurClemens thoughts?

@MoOx

This comment has been minimized.

Member

MoOx commented Oct 2, 2017

Maybe. I have to admit that this kind of issues are a pain. Is there a webpack issue about this?

@MoOx MoOx closed this in #1211 Dec 4, 2017

MoOx added a commit that referenced this issue Dec 4, 2017

`@phenomic/core`: Prevent watcher from crashing when a file is rename…
…d (or saved with vim) (#1211)

Fixes #1208
Fixes #1157

The `file` might be `undefined` if it's a temporary file that's deleted before the transformers run.

The watcher close function gets called with an undefined file sometimes when you rename/delete a file. The default Node.js fs.watch function is known for having some bugs, but adding an undefined check before deleting the file fixes the problem until the webpack team fixes it.

MoOx added a commit that referenced this issue Dec 4, 2017

`@phenomic/core`: Prevent watcher from crashing when a file is rename…
…d (or saved with vim) (#1211)

Fixes #1208
Fixes #1157

The `file` might be `undefined` if it's a temporary file that's deleted before the transformers run.

The watcher close function gets called with an undefined file sometimes when you rename/delete a file. The default Node.js fs.watch function is known for having some bugs, but adding an undefined check before deleting the file fixes the problem until the webpack team fixes it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment