question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue found when installing 'request' package

See original GitHub issue

I installed require npm package on app, imported it in react module, and got this error:

Error in ./~/request/lib/har.js
Module not found: Error: Cannot resolve module 'fs' in D:\projects\date-range-picker\node_modules\request\lib
 @ ./~/request/lib/har.js 3:9-22

Error in ./~/request/~/forever-agent/index.js
Module not found: Error: Cannot resolve module 'net' in D:\projects\date-range-picker\node_modules\request\node_modules\forever-agent
 @ ./~/request/~/forever-agent/index.js 6:10-24

Error in ./~/request/~/forever-agent/index.js
Module not found: Error: Cannot resolve module 'tls' in D:\projects\date-range-picker\node_modules\request\node_modules\forever-agent
 @ ./~/request/~/forever-agent/index.js 7:10-24

Error in ./~/request/~/tough-cookie/lib/cookie.js
Module not found: Error: Cannot resolve module 'net' in D:\projects\date-range-picker\node_modules\request\node_modules\tough-cookie\lib
 @ ./~/request/~/tough-cookie/lib/cookie.js 32:10-24

Error in ./~/request/~/tunnel-agent/index.js
Module not found: Error: Cannot resolve module 'net' in D:\projects\date-range-picker\node_modules\request\node_modules\tunnel-agent
 @ ./~/request/~/tunnel-agent/index.js 3:10-24

Error in ./~/request/~/tunnel-agent/index.js
Module not found: Error: Cannot resolve module 'tls' in D:\projects\date-range-picker\node_modules\request\node_modules\tunnel-agent
 @ ./~/request/~/tunnel-agent/index.js 4:10-24

Is a very similar issue to what’s described here: https://github.com/request/request/issues/1691

In the issue above is indicated to tweak the webpack.config.js file to cater for those elements that are being called.

Is there any known workaround for this?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
gaearoncommented, Aug 28, 2016

Verified that this fixes the problem in your repo:

         function search(query) {
-            return fetch(`/api/holidays?${query}`, {
+            return fetch(`/holidays?${query}`, {
                 accept: 'application/json',                
             }).then(checkStatus)
             .then(parseJSON);
@@ -129,7 +129,7 @@ class Form extends Component {
           return response.json();
         }

-        search(querystring);
+        search(querystring).then(result => console.log(result));

     }

1reaction
gaearoncommented, Aug 28, 2016

then added the string /api/ in the fetch() call

You don’t need to. Why did you do this?

We don’t treat URLs starting with /api in any special way. We just prepend the proxy URL to the URL you pass to fetch().

So it tried to load https://holidayapi.com/v1/api/holidays because that’s what you get by concatenating https://holidayapi.com/v1 and /api/holidays. You probably meant fetch('/holidays') instead.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to PIP Install Requests Python Package - ActiveState
Pip install Requests into a Virtual Directory​​ You can use pip to install a specific version of the Requests module into a Virtualenv ......
Read more >
Python error when attempting to install 'request' package ...
I'm getting the below error message when attempting to install 'request' Python package running command pip install request :.
Read more >
Installation of Requests — Requests 2.28.1 documentation
This part of the documentation covers the installation of Requests. The first step to using any software package is getting it properly installed....
Read more >
Use of the REQUEST_INSTALL_PACKAGES permission
The REQUEST_INSTALL_PACKAGES permission only takes effect when your app targets Android API level 26 or later on devices running Android 8 or later....
Read more >
How to Install Requests Library in Python | - Agira Technologies
How to Install Requests Library in Python · 1.Verify Python Installation · 2. Access to Python Over Terminal · 3. Import Requests Library...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found