-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Cannot read property 'type' of undefined #2749
Comments
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. |
I also have the same issue in VS 2019. I have not tried editing in VS code yet, will try that next. |
I could repro the same issue randomly in this simple project:
// foo.js
import "./bar.css";
console.log("foo"); /* bar.css */
body { margin: 1px; } {
"name": "parcel-bug",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"parcel-bundler": "^1.12.1"
}
}
I'm working on git bash and mintty to connect the virtual machine. Editor is Arch's vim. |
I solved this issue thanks to #2716 and https://parceljs.org/hmr.html#safe-write ! |
I don't "think" this is the issue with Visual Studio. If it was I don't see why parcel version 1.10.3 would work fine for me. |
I have the exact same issue. |
This happens intermittently for me using Webstorm on Windows 10, with a barely modified nano-react-app. Edit: ah, I see, I have to disable safe write in WS |
I upgraded to parcel 1.12.3 same issue. I tried VS code and everything works as expected. There seems to be some kind of conflict with Visual Studio. I tried to find settings to control "Safe Write" but there does not seem to be any :( So for now will have to edit the client side assets in VS code I guess. It is actually a better editor for that anyway and the npm plugin makes parcel watching easy. Just kind of weird having to jump between two programs to work on a project. Still that is easier than working with webpack lol. |
I have the same problem using WebStorm. But with Atom I don't have one. |
Can you turn off "Safe Write" in WebStorm? I have not found any way to disable it in Visual Studio yet. |
I have not found too |
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. |
It seems like this issue is going to keep popping up over and over unless it gets fixed. I don't have any issues at all with Webpack and Visual Studio, what is Webpack using to watch files? |
I think at the very least, undefined could be caught and advice what is going on and what the user should do. Note that I've hit this issue with Atom. |
FYI, we're working on a new watcher for Parcel 2 which should be much more reliable. https://github.com/parcel-bundler/watcher |
That looks awesome :) Any ETA at all? |
Well the new watcher will be in Parcel 2. We're getting close to the first alpha, so hopefully not too much longer. |
Great, can't wait to test it out. |
I was getting this error intermittently (about 1/3 of the time). My project was inside a Dropbox folder. After exiting Dropbox, I couldn't reproduce (successfully rebuilt and loaded 40+ times), so Dropbox might be one cause of this bug. The work-around is to exit Dropbox or move the project outside of Dropbox. (Interestingly, I've never had this type of problem with WebPack HMR from inside Dropbox.) |
Does the watcher have a separate issue that can be used for tracking, @devongovett ? |
Are we any closer to being able to test out parcel 2 with the new watcher yet? |
in case Emacs solution when use vcs(git), (setq vc-make-backup-files nil) |
I started looking into why deleting a file that's part of a glob causes this error, but I haven't gotten too far. Even if you are working on Parcel 2.0, would you consider fixing this? This isn't some deep tricky file-watching bug; Chokidar is working just fine here. It's a plain old logic bug in Bundler, I'll bet you anything. |
This still happens in vim with
|
same problem now |
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. |
Thanks for the tip. Putting |
I happened to do the same when git hook. |
Disabling backupcopy worked for me as well ( ubuntu 18 ), however I don't want to disable backups. Setting a new
You can find more info on backups with |
This can be reproduced without using an editor. I created a simple project displaying the problem. The gist of it is
Tested on Windows 10 and Ubuntu on WSL |
@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?? |
We've just updated to Visual Studio 2019 Preview and we're certain we didn't experience this before. Does anyone have any known work arounds besides switching to WebPack or editing the file in another editor? Using Windows 10. Parcel Bundler 1.12.4. Has anyone tried 2.0.0-nightly.2xx builds? Do anyone know when this might get released or how far they are through it? |
We've just release 2.0.0-beta.1 😉 |
For anyone using WebStorm/PyCharm/PhpStorm (or any other JetBrains IDE), you can work around this by going to Settings > Appearance & Behavior > System Settings and unchecking "Use 'safe write'" in the Synchronization section. |
@tghw Hey, thank you for the update and I appreciate the help. I do understand that this is an open source project and you work on it according to your availability. But if I may be honest I already decoupled parcel and replaced it with Webpack and I am also sorry I did not started things out with Webpack due to this experience. Developer experience is super important especially for a build tool. I wasted precious hours on that project for choosing to go with Parcel. I hope you improve your response time if you want to prevent future bounce from this tool. In a fast-pace environment that we live in as developers and with the standards we aim to from tools we work in responding to an issue after a whole year and a half is inconsiderable. And becomes a major factor to not choosing a certain technology for proudction or honestly also for development. |
@JonathanDn I don't work on ParcelJS, I am just another user of it. I tagged you as a courtesy because you were using the same family of IDE that I was and I figured you would appreciate a workaround. Unfortunately, that seems not to have been the case. That said, I also want to say that I am greatly appreciative of the team's work on making something far more usable and intuitive than Webpack. It has saved me dozens of hours of configuration, and aside from this minor annoyance, which was easy to work around, it has been a fantastic tool and I'm eagerly looking forward to V2. Writing a file watcher is not a trivial task and there are a lot of corner cases that can cause a file watcher to stumble. In this case, the common thread of every instance of this error is the IDE or editor saving files by pulling the file out from under Parcel and replacing it with a new one. Part of using and participating in open source projects is that sometimes you have to solve your own problems. If you had read the comments above and tried to understand the root cause of the issue, especially with the documented workarounds for other IDEs and editors, it should have been trivial for you to find the solution I posted. You could have saved yourself "precious hours" and helped the community at the same time. Hopefully next time you will try that tack instead of expecting the developers to wait on you hand and foot. |
@tghw than my whole message is not directed at you but to the creators of this library and maintainers(if they are even maintaining it.) We can agree to disagree on this. When I use a seemignly stable tool I expect the basics to work out of the box. Especially with all the buzz around Parcel and promising of a "lightweight, zero config, stable tool" . If I would argue that a tool I built is battle-tested and ready for adoption, or would advertise this on various places to get traction and reputation for my project and myself - I would make sure it works. And if it breaks, I would have the decency to sit down and solve critical issues You try to portray the open source world as a naaive and pink candy store in which you can choose whatever and it's at your own risk. I disagree with that approach deeply. I think open source is wonderful and have donated various code to projects and created my own repositories and gists that I share with people. I never persuaded a message that my creations should be adopted in serious projects nor did I advertised them. There are more serious and battle-tested technologies out there. IMO ParcelJS is definitely amature. Webpack is an industry standard and for a reason. If ParcelJS or any other competing tool would want developers to actually use them and consider them seriously. This kind of critical issues need to be thought of before advertising. And if discovered after, have some decency to not leave people hanging for over a year without a clear answer. And your expectation for any user of a package to read all corresponsdense of every issue discovered is not realistic. If you like doing it it's your hobby, enjoy. The majority of people upon installing a tool, just wish to use it for its purpose and go do other stuff. |
@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... |
@tghw I did read it a long time ago. If the issue was resolved there was a clear solution simply written by someone here and upvoted many times. Back when I tried to solve this I had read everything written here. Tried all the suggestions but failed to make it work. I searched in other threads but could not find a clear way to resolve this. I thank you for the invitation to continue wasting my and other people's time. I kindly decline. Moved to work with Webpack and will continue to work with it. Once a serious alternative tool will present itself and will have reasonable support and maintainance time I will consider it as well. Have a pleasent day / evening. |
@tghw And for the record, there are various standard webpack configurations that give you HMR and what-not in 0 effort. So to your question no I did not spend so much time porting to webpack, i just picked a configuration that fit my purpose, edited it really a bit and thats it. It really pays off to understand webpack and learn the power it gives you and the level of customization. For prototyping I use a preconfigurate template(for years now...) and actually even for production and more serious projects I use the tempaltes and adjust as I go according to the project needs. case by case. |
I am having same issues but with React+Typescript project, anytime I edit an import it shows the error and I have to restart the watch. very weird
"dependencies": {
"@testing-library/jest-dom": "^5.11.5",
"@testing-library/react": "^11.1.0",
"@types/enzyme-adapter-react-16": "^1.0.6",
"@types/jest": "^26.0.15",
"@types/sinon": "^9.0.8",
"axios": "^0.19.2",
"bcrypt": "^5.0.0",
"bootstrap": "^4.5.0",
"chai": "^4.2.0",
"chai-http": "^4.3.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",
"eslint-config-standard": "^14.1.1",
"history": "^5.0.0",
"jest": "^26.6.1",
"lodash": "^4.17.19",
"mocha": "^8.0.1",
"moment": "^2.27.0",
"pure-store": "^1.1.0",
"react": "^16.0.0",
"react-dom": "^15.0.0 || ^16.0.0",
"react-input-mask": "^3.0.0-alpha.2",
"react-minimal-pie-chart": "^8.0.1",
"react-orgchart": "^1.0.5",
"react-ripples": "^2.2.1",
"react-router": "^6.0.0-alpha.5",
"react-router-dom": "^6.0.0-alpha.5",
"react-table": "^7.1.0",
"react-tabs": "^3.1.1",
"react-tag-autocomplete": "^5.13.1",
"react-tooltip": "^4.2.6",
"regenerator-runtime": "^0.13.7",
"ts-jest": "^26.4.3"
},
"devDependencies": {
"@types/bcrypt": "^3.0.0",
"@types/body-parser": "^1.19.0",
"@types/enzyme": "^3.10.7",
"@types/mocha": "^7.0.2",
"@types/node": "^14.0.13",
"@types/react": "^16.9.35",
"@types/react-dom": "^16.9.8",
"@types/react-input-mask": "^2.0.5",
"@types/react-table": "^7.0.23",
"@types/react-tabs": "^2.3.2",
"@typescript-eslint/eslint-plugin": "^3.7.1",
"@typescript-eslint/parser": "^3.7.1",
"eslint": "^7.6.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-standard": "^4.0.2",
"node-sass": "^4.14.1",
"parcel-bundler": "^1.12.4",
"sass": "^1.26.10",
"sinon": "^9.2.0",
"sinon-chai": "^3.5.0",
"ts-node": "^9.0.0",
"typescript": "^3.9.5"
}
}
|
FWIW perhaps another cause resulting in the same error message, but in my case removing the |
I'm having the same problem on Codeanywhere, I'm going to check if updating to Parcel 2 beta solves this. |
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. |
So I copied html5boilerplate [ https://github.com/h5bp/html5-boilerplate ] for something and install/run this without any change. Left the PC running as it is. Come back after 30 minutes.
Like how..? There's just one dependency:
|
Issue exists on v1.12.3 using |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. |
Thanks! |
I experienced the following problem with parcel/chalk: npm view chalk version
|
The things worked with this version: chalk 4.1.2 |
I had the same issue. |
🐛 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)
🤔 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
The text was updated successfully, but these errors were encountered: