You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -22,19 +22,6 @@ After many tests, the proxy based solutions (naive, FlairSolverr) don't really w
22
22
* rewrite leetcode-cli to replace request with modified node-libcurl
23
23
* update the vscode leetcode plugin(extension) to use the enhanced leetcode-cli plugin
24
24
25
-
Finally, we use the curl_chrome116 command line + exec as the solution, because the NODE_MODULE_VERSION incompatibility issue in vscode. The vscode itself is built by electron, but we build the modified version of node-libcurl with node (18.12.0). Although in vscode leetcode extension, it spawns a separate node process (18.12.0) to run the underlying leetcode commands, we still got the NODE_MODULE_VERSION error.
Refer to [INSTALL.md](https://github.com/lwthiker/curl-impersonate/blob/main/INSTALL.md#macos)
40
27
+ install prebuild binary through brew
@@ -71,10 +58,146 @@ cd ../ && rm -Rf build
71
58
72
59
### Compile node-libcurl with curl-impersonate
73
60
Build node-libcurl from source on macOS
74
-
```
75
61
62
+
#### Option 1: node-libcurl (using lib/util2.js)
63
+
build node-libcurl from source in two versions, one version is using node 18.12.0 (match to the version in vscode leetcode extension settings), the other one is using electron 27.3.6 (match to the vscode based electron version). copy two versions to different locations, and we won't hit the NODE_MODULE_VERSION incompatibility error!
64
+
```
76
65
# install the build tool node-gyp
77
66
npm i -g node-pre-gyp node-gyp
67
+
68
+
# install electron 27.3.6, check https://releases.electronjs.org/ for electron versions
69
+
# we need NODE_MODULE_VERSION 118 corresponded electron version
70
+
npm i -g electron@v27.3.6
71
+
72
+
# verify the electron version
73
+
➜ electron -v
74
+
v27.3.6
75
+
76
+
# copy /usr/bin/curl-config to /usr/local/bin/curl-config
77
+
# and make sure /usr/local/bin is before /usr/bin in PATH
78
+
# then modify /usr/local/bin/curl-config and update prefix from /usr to /usr/local/opt/curl
79
+
# to avoid clang: error: no such file or directory: '/usr/include'
Alternatively, we can use exec to execute curl_chrome116 to avoid below NODE_MODULE_VERSION compatibility issue for native build lib like node-libcurl! Follow the steps in [Option 1](#option-1-node-libcurl-using-libutil2js) except those related to electron!
126
+
```
127
+
Failed to list problems: Error: The module '/Users/harry/.vscode/extensions/leetcode.vscode-leetcode-0.18.1/node_modules/vsc-leetcode-cli/node_modules/node-libcurl/lib/binding/node_libcurl.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 108. This version of Node.js requires NODE_MODULE_VERSION 118. Please try re-compiling or re-installing the module (for instance, using `npm rebuild` or `npm install`)..
128
+
```
129
+
130
+
### Test Conclusion
131
+
| Not working | Working |
132
+
| ----------- | ----------- |
133
+
| original node-libcurl | curl-impersonate |
134
+
| naive proxy | node exec + curl-impersonate |
135
+
|| modified node-libcurl |
136
+
137
+
### TODO
138
+
139
+
### Update the vscode leetcode extension
140
+
See the manual steps of copying, linking folders in [Option 1](#option-1-node-libcurl-using-libutil2js)
141
+
142
+
### References
143
+
-[Could not login with both 'leetcode user -l' and 'leetcode user -c'](https://github.com/skygragon/leetcode-cli/issues/218)
144
+
-[Cannot login with premium account](https://github.com/skygragon/leetcode-cli/issues/194)
145
+
-[Failed to log in with a leetcode.com account](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/478), [a comment](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/478#issuecomment-564757098)
146
+
- Proxy Server to bypass Cloudflare: [FlareSolverr](https://github.com/FlareSolverr/FlareSolverr), [naiveproxy](https://github.com/klzgrad/naiveproxy)
147
+
-[How To Bypass Cloudflare in 2024](https://scrapeops.io/web-scraping-playbook/how-to-bypass-cloudflare/)
148
+
-[How to Bypass Cloudflare in 2024: The 8 Best Methods](https://www.zenrows.com/blog/bypass-cloudflare)
149
+
-[How to bypass Cloudflare when web scraping in 2024](https://scrapfly.io/blog/how-to-bypass-cloudflare-anti-scraping/)
150
+
-[node abi versions](https://github.com/nodejs/node/blob/main/doc/abi_version_registry.json)
looks like macOS does some magic when loading /usr/lib/libcurl.4.dylib (in memory or cache?)
183
+
```
184
+
- The leetcode extension is not always running in separate process space from vscode itself
185
+
186
+
The vscode itself is built with electron, but the modified version of node-libcurl was built with node (18.12.0). Although in vscode leetcode extension, node 18.12.0 is nominated as the node.js executable path and the extension does spawn a separate node process to run the underlying leetcode commands, we still got the NODE_MODULE_VERSION incompatible error.
- Will different install locations for the node-libcurl module (e.g. as one of the node 18.12.0 global modules) fix the NODE_MODULE_VERSION incompatible issue?
198
+
199
+
### Archived notes
200
+
```
78
201
# build & install node-libcurl from source, first time (to generate build files)
79
202
# npm_config_build_from_source=true npm i node-libcurl
80
203
# use yarn as npm doesn't create build folders and make files!
- Fix the NODE_MODULE_VERSION error by building node-libcurl [with electron](https://github.com/JCMais/node-libcurl?tab=readme-ov-file#electron-aka-atom-shell)
158
-
```
159
-
Failed to list problems: Error: The module '/Users/harry/.vscode/extensions/leetcode.vscode-leetcode-0.18.1/node_modules/vsc-leetcode-cli/node_modules/node-libcurl/lib/binding/node_libcurl.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 108. This version of Node.js requires NODE_MODULE_VERSION 118. Please try re-compiling or re-installing the module (for instance, using `npm rebuild` or `npm install`)..
160
-
```
161
-
- Try different install locations for the node-libcurl
162
-
163
-
### Update the vscode leetcode extension
164
-
165
-
### References
166
-
-[Could not login with both 'leetcode user -l' and 'leetcode user -c'](https://github.com/skygragon/leetcode-cli/issues/218)
167
-
-[Cannot login with premium account](https://github.com/skygragon/leetcode-cli/issues/194)
168
-
-[Failed to log in with a leetcode.com account](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/478), [a comment](https://github.com/LeetCode-OpenSource/vscode-leetcode/issues/478#issuecomment-564757098)
169
-
- Proxy Server to bypass Cloudflare: [FlareSolverr](https://github.com/FlareSolverr/FlareSolverr), [naiveproxy](https://github.com/klzgrad/naiveproxy)
170
-
-[How To Bypass Cloudflare in 2024](https://scrapeops.io/web-scraping-playbook/how-to-bypass-cloudflare/)
171
-
-[How to Bypass Cloudflare in 2024: The 8 Best Methods](https://www.zenrows.com/blog/bypass-cloudflare)
172
-
-[How to bypass Cloudflare when web scraping in 2024](https://scrapfly.io/blog/how-to-bypass-cloudflare-anti-scraping/)
173
-
-[node abi versions](https://github.com/nodejs/node/blob/main/doc/abi_version_registry.json)
0 commit comments