Skip to content
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

Watch hangs / doesn't watch anymore in parcel-bundler@1.11.0 #2727

Closed
ThreadPitt opened this issue Mar 6, 2019 · 17 comments
Closed

Watch hangs / doesn't watch anymore in parcel-bundler@1.11.0 #2727

ThreadPitt opened this issue Mar 6, 2019 · 17 comments

Comments

@ThreadPitt
Copy link

🐛 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 parcel-bundler@1.11.0
Node 8.12.0
npm/Yarn npm 6.4.1
Operating System Windows Server 2016
@garthenweb
Copy link
Contributor

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.

@WayneHiller
Copy link

WayneHiller commented Mar 7, 2019

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... [6:25:08 AM]: Producing bundles... [6:25:08 AM]: × Cannot read property 'type' of undefined [6:25:08 AM]: at Bundler.createBundleTree (E:\Development\AIN 2\ABS\Setup\ABS Setup\node_modules\parcel-bundler\src\Bundler.js:652:54) 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)

@ThreadPitt
Copy link
Author

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%

@ThreadPitt
Copy link
Author

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';
^
};

@ThreadPitt
Copy link
Author

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?

@WayneHiller
Copy link

WayneHiller commented Mar 18, 2019

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 :(

@ThreadPitt
Copy link
Author

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\Roaming\npm\node_modules\parcel-bundler\src\Bundler.js:654:54)
at Bundler.createBundleTree (C:\Users\xxx\AppData\Roaming\npm\node_modules\parcel-bundler\src\Bundler.js:721:12)
at Bundler.createBundleTree (C:\Users\xxx\AppData\Roaming\npm\node_modules\parcel-bundler\src\Bundler.js:721:12)
at Bundler.bundle (C:\Users\op.DEV\xxx\Roaming\npm\node_modules\parcel-bundler\src\Bundler.js:298:14)
at process._tickCallback (internal/process/next_tick.js:68:7)

Maybe this can help?

@jehkinen
Copy link

jehkinen commented Apr 9, 2019

Have the same issue for Win10 and parcel-bundler 1.11.1

@ratfactor
Copy link

ratfactor commented Apr 12, 2019

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!

@dharmax
Copy link

dharmax commented Jul 22, 2019

Same issue.... Grrr

@WayneHiller
Copy link

@dharmax What editor are you using?

@dharmax
Copy link

dharmax commented Jul 23, 2019 via email

@jehkinen
Copy link

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

#221

@WayneHiller
Copy link

@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.

@jehkinen
Copy link

@WayneHiller I agree, thank you

@DeMoorJasper
Copy link
Member

DeMoorJasper commented Jul 28, 2019

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

@joestant
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants