privacy-tech-lab / privacy-pioneer

Privacy browser extension for analyzing web traffic of visited websites
https://www.privacytechlab.org/
Other
22 stars 1 forks source link

Fix development setup issue #560

Closed natelevinson10 closed 5 months ago

natelevinson10 commented 5 months ago

Encountering issues while attempting to run Privacy Pioneer dev mode.

Issue: Following instructions from the readME (i.e. cloning repo locally, running npm install, adding holdAPI.js) led to this error upon running npm start: b6d04ae2-588f-4962-93ee-748e302002fc

Deleting the node_modules folder and package-lock.js and rerunning npm install (as instructed via Note in the readME) was not working, so I wiped node off my laptop and re-cloned the repo. The initial npm install did not work, but deleting node_modules folder and package-lock.js and then rerunning npm install got the firefox browser to pop open when I ran npm start. However, there are now two frontend compilation errors:

Screenshot 2024-01-14 at 3 27 33 PM

I have tried copying the package.json and package-lock.json from the remote repo into my local repo and that did not work.

More context: MacBook Pro Apple M1 chip Node v21.5.0 Npm v10.3.0

SebastianZimmeck commented 5 months ago

@dadak-dom, do you get the same errors when you install?

@danielgoldelman, what should we do here?

dadak-dom commented 5 months ago

Just deleted the repo and went through all the steps from scratch, and I was able to get it running like before. However, I did run into some issues with getting the tensorflow library to install properly, but I was able to fix it with the first suggested solution here. After I fixed that, everything ran as usual. Might be worth a shot @natelevinson10

SebastianZimmeck commented 5 months ago

Thank you, @dadak-dom!

Can you update the readme with a sentence on you tensorflow solution?

SebastianZimmeck commented 5 months ago

Which node version did you use, @dadak-dom?

dadak-dom commented 5 months ago

Which node version did you use, @dadak-dom?

node version 18.18.2 and npm version 10.3.0

natelevinson10 commented 5 months ago

I just tried running the dev version on a different laptop and it worked as expected, I also had the same hiccup with tensorflow but the solution dom linked worked. This means whatever is causing these issues is specific to my personal laptop. I will try to figure out exactly what that could be.

danielgoldelman commented 5 months ago

@SebastianZimmeck, Nate and I are talking through it separately.

SebastianZimmeck commented 5 months ago

I just tried running the dev version on a different laptop and it worked as expected, I also had the same hiccup with tensorflow but the solution dom linked worked. This means whatever is causing these issues is specific to my personal laptop. I will try to figure out exactly what that could be.

Sounds good!

If this is a fairly idiosyncratic issue related to the concrete setup of your laptop, no need to spend a whole lot of time on it. So, feel free to make the call when to stop exploring one way or the other.

natelevinson10 commented 5 months ago

Ok, will do. I decided to reinstall macOS completely incase this is caused by an issue rooted deep in my system preferences. Hopefully that solves it, will update once reinstall is finished.

SebastianZimmeck commented 5 months ago

I mean, if that does not help, I don't know what would. :thumbsup:

natelevinson10 commented 5 months ago

Quick update, after the reinstall My mac ran into a bug with iCloud and have been troubleshooting with tech support for a few hours now. Hopefully this gets resolved soon and I check if the node issues are resolved but as it currently stands I am virtually locked out of my MacBook.

SebastianZimmeck commented 5 months ago

No worries, please take the time necessary to fix this.

natelevinson10 commented 5 months ago

Finally got my laptop working again, just tried launching privacypioneer after the OS reinstall and I am getting the tensorflow error dom got(which is good I suppose). The issue linked did not work for me as it seems to be specific to windows , so I am wondering if anyone has ran into the same tensorflow/tfjs error on macOS, specifically with an M1 chip. Also, anyone on Mac who is able to launch the dev version I'd like to know what version of node and npm you are using.

SebastianZimmeck commented 5 months ago

so I am wondering if anyone has ran into the same tensorflow/tfjs error on macOS, specifically with an M1 chip. Also, anyone on Mac who is able to launch the dev version I'd like to know what version of node and npm you are using.

@danielgoldelman, which version of node and npm are you using? Also, do you have a tensorflow solution for macOS?

danielgoldelman commented 5 months ago

@natelevinson10 @SebastianZimmeck I have not personally run the code on an M1 chip, but I have on an M2. I don't believe anyone in our lab has tried specifically on M1. To the best of my knowledge, my node version would be at least 21.1.1, npm at least 10.1.0, so no breaking changes from Nate's setup. However I cannot verify the specific values at this time.

In regards to tensorflow-specific issues, I'd like to suggest attempting global saving of tensorflow via npm. Of course this is not ideal for verification of PP's usability on other machines, but it might be worth a shot. Just make sure that the version downloaded via npm i -g tensorflow@<> is the same as we use in the extension.

Additionally, it might be worth a shot trying to run npm run dev, then packing the extension into xpi format (I have described the steps to the team separately), and loading it into the Firefox extension store as a packed extension. That might get around some of the issues.

natelevinson10 commented 5 months ago

I was able to solve the tensorflow issue by running xcode-select --install. However, when I run npm start, I still get the same frontend compilation errors from before (https://github.com/privacy-tech-lab/privacy-pioneer/issues/560#issue-2080895093). As a test, I installed npmvet used for vetting package versions. Here is the result:

Screenshot 2024-01-18 at 1 07 07 PM

It appears that running any iteration of npm install downloads the wrong packages, regardless of the contents of package.json. I have already reset my OS, wiped node from my laptop, and reset all of my executable paths, so this most certainly is the cause of the errors. I will continue to look into this, and I am curious if anyone has any experience with this and could offer a possible solution as well.

SebastianZimmeck commented 5 months ago

Good progress, @natelevinson10!

I was able to solve the tensorflow issue by running xcode-select --install.

Could you add a sentence to the readme to that effect and clarifying macOS vs Windows solutions?

SebastianZimmeck commented 5 months ago

It appears that running any iteration of npm install downloads the wrong packages, regardless of the contents of package.json.

That is weird. Is there maybe a discrepancy between package.json. and package-lock.json? Although, normally it is the other way around, package.json can override package-lock.json whenever a newer version is found for a dependency in package.json.

natelevinson10 commented 5 months ago

Updated readME. Will take a look at this later. Thanks

That is weird. Is there maybe a discrepancy between package.json. and package-lock.json? Although, normally it is the other way around, package.json can override package-lock.json whenever a newer version is found for a dependency in package.json.

natelevinson10 commented 5 months ago

I was able to successfully compile and run the dev setup (finally.) I had to first copy package-lock.json from the repo onto my local, then run npm ci . I then ran npm start and saw the line [dev:extension] sh: web-ext: command not found in an error message indicating the web-ext package was not installed (I am not sure why this was the case). I ran npm install -g web-ext to install it globally and then npm start worked. While this fix may not be the cleanest, it worked so I suppose it is a win. Still, I am not sure why I am getting these issues with my node dependencies.

SebastianZimmeck commented 5 months ago

Excellent! We should talk about this tomorrow and see whether we need to change the setup and/or readme.

danielgoldelman commented 5 months ago

@natelevinson10 @SebastianZimmeck I was able to recreate Nate's bug. I created a new branch on this issue, forgot to name it with the hashtag syntax so it is not showing above this comment, but you should be able to checkout origin/issue-560, with a bump from web-ext version 7.6.1 --> 7.10.0, which fixed the error for me. Nate, please check on your computer.

natelevinson10 commented 5 months ago

This worked perfectly, npm install followed by npm start worked exactly how it should! @danielgoldelman

SebastianZimmeck commented 5 months ago

Excellent, @danielgoldelman and @natelevinson10!

@natelevinson10, could you update the readme accordingly?