parcel: Cannot read property 'type' of undefined
š bug report
I have a small VueJS project. I am running āparcel watch index.html --log-level 4 --out-dir wwwrootā from npm. On version 1.11.0 it would stop reacting to file changes after a few saves. I updated to version 1.12.0 and the same thing is happening but now I get an error (see below).
Note: I downgraded to parcel version 1.10.3 and everything works as expected when watching.
š Configuration (.babelrc, package.json, cli command)
{
"name": "abs-setup",
"description": "ABS Setup",
"author": "Wayne Hiller",
"scripts": {
"dev": "parcel watch index.html --log-level 4 --out-dir wwwroot",
"build": "parcel build index.html --out-dir wwwroot",
"publish": "npm run build && del-cli bin/Release/netcoreapp2.2/publish && dotnet publish -c Release /p:PublishProfile=Properties\\\\PublishProfiles\\\\FolderProfile.pubxml"
},
"devDependencies": {
"@aspnet/signalr": "1.1.2",
"@babel/core": "7.3.4",
"@babel/preset-env": "7.3.4",
"@vue/component-compiler-utils": "^2.6.0",
"axios": "0.18.0",
"bootstrap": "4.3.1",
"bootstrap-vue": "2.0.0-rc.11",
"less": "^3.9.0",
"parcel-bundler": "1.12.0",
"parcel-plugin-clean-easy": "1.0.2",
"vue": "2.6.7",
"vue-axios": "2.1.4",
"vue-template-compiler": "^2.6.7",
"del-cli": "1.1.0"
},
"dependencies": {
"vue-hot-reload-api": "^2.3.3"
},
"parcelCleanPaths": [
"wwwroot/*.*",
"wwwroot/debug"
]
}
š¤ Expected Behavior
No error
šÆ Current Behavior
Error being generated after 5 or 6 saves of the same .vue file.
[12:13:38 PM]: Ć Cannot read property 'type' of undefined [12:13:38 PM]: 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)
š Your Environment
Software | Version(s) |
---|---|
Parcel | 1.12.0 |
Node | 10.15.2 |
npm/Yarn | 6.9.0 |
Operating System | Win 10 x64 |
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 13
- Comments: 60 (5 by maintainers)
I solved this issue thanks to #2716 and https://parceljs.org/hmr.html#safe-write ! Unfortunately I missed it. Sorry š
FYI, weāre working on a new watcher for Parcel 2 which should be much more reliable. https://github.com/parcel-bundler/watcher
This still happens in vim with
backupcopy=yes
and with all plugins disabled. š š¬I have had this problem as well but I am using linux/vi and other editors, as pointed out it is a known problem see bug #2716 and https://parceljs.org/hmr.html#safe-write where problem is described along with out to turn of the auto write features off tools such as WebStorm etc are described.
FWIW perhaps another cause resulting in the same error message, but in my case removing the
.cache
directory helped.@JonathanDn If you are going to comment on an existing issue, on any project, open source or otherwise, then you should at least take the time to read the thread. As was the case here, being too lazy to read a thread makes it very likely that you will miss out on crucial information that could help you solve the problem yourself. No one is expecting you to read every issue in the project, but if one applies to you, do yourself a favor and read it.
By reading it, you might have also understood that the file watcher in V1 could not be fixed for this particular issue because it would be a breaking change, so the developers opted to include the fix in the forthcoming V2. Considering it can be easily worked around, this is a very reasonable decision.
It took me less than 20 minutes to read this thread, understand the problem, and find a workaround for my IDE, helped in part by those who commented before me with workarounds for their IDEs. Thatās a small price to pay and now Parcel is working great for me. I imagine you spent a whole lot more time porting to Webpackā¦
We do fix critical bugs, most bugs in Parcel 1 have been fixed. This one we couldnāt really fix without a new watcher⦠Which is a breaking change semver wise anyway⦠So releasing a fix in Parcel 2 seems like a logical choice
Pretty sure a lot of devs wanna get rid of webpack sooner than laterā¦
I want my engineering team to use Parcel, but the fact that it canāt correctly watch globs is becoming a problem. Iām tempted to try Parcel 2 to see if it doesnāt have bugs so large as ācrashes if you add and move files,ā but Iām not sure how hopeful to be, since itās alpha, and apparently there is a brand-new file watcher?
Iām totally the kind of programmer who would turn up my nose at existing file-watchers and write my own, but existing file-watchers are decent IMO, and the fact that this bug was never fixed, and probably will never be fixed, doesnāt give me a ton of confidence in the Parcel team, meaning I wonder if they should be writing a file watcher or just working on shipping reasonably non-buggy software? Will the bugs be fixed, this time, in Parcel 2, or will the team immediately start working on Parcel 3?
I just had to vent some skepticism and frustration there. My lack of faith in the Parcel team may be totally unfounded.
Are we any closer to being able to test out parcel 2 with the new watcher yet?
I have the exact same issue.
createBundleTree
callsbundle.findCommonAncestor
, which returns undefined. The while loop condition infindCommonAncestor
fails immediately becausea !== b
, solast
is undefined and returned.I had the same issue.
I happened to do the same when git hook. The solution was to drop lint-staged version from 10 -> 7.
On win 10 using vim
backupcopy=yes
solved it for me!I am experiencing the same bug, Iām also on x64 Windows 10 and Iām using Visual Studio 2017. I canāt reproduce the bug when using another text editor, so it seems to be related to VS 2017.
So I copied html5boilerplate [ https://github.com/h5bp/html5-boilerplate ] for something and install/run this without any change. It opened up on my browser just fine.
Left the PC running as it is. Come back after 30 minutes.
Like how�
Thereās just one dependency:
this has been the solution for me - updating to the next parcel version. parcel 2 seems much better and faster anyway; everything works the same.
@devongovett Its wonderful that your working on a new watcher. I do not see any ETA for that.
I am using webstorm and still experience this broken watch issue all the time. Any temp fix??
Disabling backupcopy worked for me as well ( ubuntu 18 ), however I donāt want to disable backups. Setting a new
backupdir
worked by adding the following lines to my.vimrc
You can find more info on backups with
:help backup
Thanks for the tip. Putting
set backupcopy=yes
in my.vimrc
also fixed the errors for me. (neovim on ubuntu 16.04)