Parcel: Watch hangs / doesn't watch anymore in [email protected]

Created on 6 Mar 2019  ยท  17Comments  ยท  Source: parcel-bundler/parcel

๐Ÿ› bug report

We use "parcel watch" with one entry point
All works fine, but seemingly at random, the watcher doesn't watch anymore, e.g. does not re-bundle when files are changed. There's no error message.

Mostly it seems to happen when previously there was an error while bundling.

๐ŸŽ› Configuration (.babelrc, package.json, cli command)

"parcel watch .\js\main.js"

"devDependencies": {
"@babel/cli": "^7.2.3",
"@babel/core": "^7.3.4",
"@babel/plugin-proposal-class-properties": "^7.3.4",
"@babel/plugin-transform-strict-mode": "^7.2.0",
"@babel/preset-env": "^7.3.4",
"@babel/preset-react": "^7.0.0",
"babel-plugin-styled-components": "^1.10.0",
"browser-sync": "^2.26.3",
"react": "^16.8.4",
"react-dom": "^16.8.4"
},
"dependencies": {
"ag-grid-community": "^20.1.0",
"ag-grid-react": "^20.1.1",
"es6-promise": "^4.2.6",
"normalize.css": "^8.0.1",
"office-ui-fabric-react": "^6.151.0",
"prop-types": "^15.7.2",
"react-router-dom": "^4.3.1",
"styled-components": "^4.1.3",
"whatwg-fetch": "^3.0.0",
"yup": "^0.26.10"
}

{
"presets": [ "@babel/preset-env", "@babel/preset-react" ],
"plugins": [
"@babel/plugin-proposal-class-properties",
"babel-plugin-styled-components",
"@babel/plugin-transform-strict-mode"
]
}

๐Ÿ’ Possible Solution

We kill the process and start "parcel watch" again.

๐ŸŒ Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | [email protected]
| Node | 8.12.0
| npm/Yarn | npm 6.4.1
| Operating System | Windows Server 2016

Bug Needs Verification Windows

Most helpful comment

This issue is not related to parcel bundler, it's related to safe-write on the webstorm IDE, I fixed that just
disabled safewrite
who faced with issue please read

https://github.com/parcel-bundler/parcel/issues/221

All 17 comments

Can you try running it with the environment UV_THREADPOOL_SIZE=16? If this helps, it should be fixed with the next release. See https://github.com/parcel-bundler/parcel/pull/2452 for more information.

I am having this issue too with a small vue.js project in VS 2019. It stops working after only a couple minutes. No errors. Like it stops detecting file changes.

Edit: I updated to parcel 1.12.0 and now I am getting this error after a few file change saves.

Building... at Bundler.createBundleTree (E:\Development\AIN 2\ABS\Setup\ABS Setup\node_modules\parcel-bundler\src\Bundler.js:719:12) at Bundler.createBundleTree (E:\Development\AIN 2\ABS\Setup\ABS Setup\node_modules\parcel-bundler\src\Bundler.js:719:12) at Bundler.bundle (E:\Development\AIN 2\ABS\Setup\ABS Setup\node_modules\parcel-bundler\src\Bundler.js:298:14) at process._tickCallback (internal/process/next_tick.js:68:7)

Can you try running it with the environment UV_THREADPOOL_SIZE=16? If this helps, it should be fixed with the next release. See #2452 for more information.

Thanks for the fast reply! I am not 100% sure where to set the environment variable in Windows so that it works with node.js/parcel properly.

I put it in Control Panel\System and Security\System -> [Advanced System Settings] -> [Environment Variables], but that does not seem to have resolved the issue 100%

Here a sample after which parcel hangs and doesn't "watch" anymore: I made an error when using the object syntax for styled components. The error is recognized properly and after that no more files are compiled/bundled.

(XXX) Unexpected token, expected "," (23:23)
const fileContainer = {
padding: '4px 10px';
^
};

Another hint that might be helpful: We are using Visual Studio (not VS Code), which probably also has watchers on the files and maybe they do interfere?

Another hint that might be helpful: We are using Visual Studio (not VS Code), which probably also has watchers on the files and maybe they do interfere?

I found down grading to version 1.10.3 helped a lot. Now it only stops working when there is an error.

Edit: Well 1.10.3 does run for a bit longer but it still stops responding to file changes after a while. It is surprising how much more difficult development is without the watch feature :(

UPDATE: Using the latest version 1.12.3 we now do get an error every now and then:

Cannot read property 'type' of undefined
at Bundler.createBundleTree (C:\Users\xxx\AppData\Roamingnpmnode_modules\parcel-bundler\src\Bundler.js:654:54)
at Bundler.createBundleTree (C:\Users\xxx\AppData\Roamingnpmnode_modules\parcel-bundler\src\Bundler.js:721:12)
at Bundler.createBundleTree (C:\Users\xxx\AppData\Roamingnpmnode_modules\parcel-bundler\src\Bundler.js:721:12)
at Bundler.bundle (C:\Users\op.DEV\xxx\Roamingnpmnode_modules\parcel-bundler\src\Bundler.js:298:14)
at process._tickCallback (internal/process/next_tick.js:68:7)

Maybe this can help?

Have the same issue for Win10 and parcel-bundler 1.11.1

I my error is (nearly) identical to that posted by @ThreadPitt

$ parcel --version
1.12.3
$ parcel index.html
Server running at http://localhost:1234 
๐Ÿšจ  Cannot read property 'type' of undefined
    at Bundler.createBundleTree (/usr/lib/node_modules/parcel-bundler/src/Bundler.js:654:54)
    at Bundler.createBundleTree (/usr/lib/node_modules/parcel-bundler/src/Bundler.js:721:12)
    at Bundler.bundle (/usr/lib/node_modules/parcel-bundler/src/Bundler.js:298:14)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)

The page serves fine at first, then I can cause the error with trivial changes (like commenting out a console.log() statement).

Platform: Slackware Linux and editing with Vim.

I see that /usr/lib/node_modules/parcel-bundler/src/Bundler.js:654:54 is in the if statement here:

// If the common bundle's type matches the asset's, move the asset to the common bundle.
// Otherwise, proceed with adding the asset to the new bundle below.
if (asset.parentBundle.type === commonBundle.type) {
    this.moveAssetToBundle(asset, commonBundle);
    return;
}

Thanks!

Same issue.... Grrr

@dharmax What editor are you using?

This issue is not related to parcel bundler, it's related to safe-write on the webstorm IDE, I fixed that just
disabled safewrite
who faced with issue please read

https://github.com/parcel-bundler/parcel/issues/221

@jehkinen It is related to parcel because parcel should be able to handle safe-writes, many system save that way. Webpack handles it no problem. Hopefully version 2.0 will fix the issue with the new c++ file monitor. Unfortunately we don't really know how long it will take for version 2.0 to get finished. I am ready to test version 2.0 as soon as it is at least somewhat operational.

@WayneHiller I agree, thank you

Parcel 2 will no longer use chokidar... and U can work around this so no reason to keep this open afaik

We've just moved to the latest Version of Visual Studio 2019 Preview to work on .Net 5 and experiencing this issue. We didn't encounter this before in 2019. Is anyone else finding this?

Was this page helpful?
0 / 5 - 0 ratings