Module not found: Error: Can't resolve 'https'

Open
#24 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
nodejs, typescript, webpack
Domain
build-system

Research direction

Reproduce the Node v20 webpack build and inspect node_modules/serpapi/esm/src/utils.js, where the missing https and querystring modules are reported. Determine whether the package or consuming build is expected to provide the resolution, then verify that the build completes without these errors.

Written by the indexing model from the issue text.

Description

I get these error message for node v20
ERROR in ./node_modules/serpapi/esm/src/utils.js 2:0-26
Module not found: Error: Can't resolve 'https' in '/Users/yasaman/Desktop/safariz/node_modules/serpapi/esm/src'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "https": require.resolve("https-browserify") }'
- install 'https-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "https": false }
ERROR in ./node_modules/serpapi/esm/src/utils.js 3:0-29
Module not found: Error: Can't resolve 'querystring' in '/Users/yasaman/Desktop/safariz/node_modules/serpapi/esm/src'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "querystring": require.resolve("querystring-es3") }'
- install 'querystring-es3'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "querystring": false }

Dominant language
TypeScript
Stars
95
Forks
33
Avg merge
8d 12h
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from serpapi/serpapi-javascript

All issues in serpapi/serpapi-javascript

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.