Era Host hosting
EraHost – Free Domain, Cheap Hosting!
Client Area
Support 24/7
Menu

Error: "Can't locate HTTP/Request.pm in @INC"

3 min read
29.08.2025

What is HTTP::Request?

The HTTP::Request module is part of the LWP (Library for WWW in Perl) package, which provides a way to send and receive HTTP requests in Perl.

Perl HTTP::Request @INC Error
@INC error — Perl found a `use` line but not the module file.

For closely related "module not installed" errors, see DBD::mysql Perl Module Not Installed Fix, vqmod::bootup — PHP domdocument Extension Required, and Server Does Not Have ImageMagick or GD Installed.

Linux VDS
High performance for your projects
  • Root access and flexible setup
  • Control panel
  • NVMe disks
  • DDR5
Linux VDS

How to Fix This Error

Check if LWP and HTTP::Request are Installed

Run the following command to check if LWP and HTTP::Request are installed:

perl -MHTTP::Request -e 'print "HTTP::Request is installed\n";'
  • If installed, you'll see:
    HTTP::Request is installed
  • If not installed, proceed to install the module.

Install LWP and HTTP::Request

Using CPAN (Comprehensive Perl Archive Network)

  1. Open terminal.
  2. Install the LWP module (which includes HTTP::Request):
    cpan install LWP

Using CPANM (CPAN Minus) (If Installed)

  1. Install CPANM (if not already installed):
    curl -L https://cpanmin.us | perl - App::cpanminus
  2. Use CPANM to install LWP:
    cpanm LWP

Verify Installation

After installation, verify if the module is available:

perl -MHTTP::Request -e 'print "HTTP::Request is installed\n";'

Add Missing Paths to @INC

If the module is installed but still not found, the library path may not be in Perl's include paths.

  1. Find the installation path of the module:
    perldoc -l HTTP::Request
  2. Temporarily add the path to @INC when running the script:
    perl -I/path/to/module script.pl

    Replace /path/to/module with the directory containing HTTP/Request.pm.

  3. To make it permanent, modify the script by adding the path:
    use lib '/path/to/module';

Check Perl Version Compatibility

Ensure the LWP version you're installing is compatible with your Perl version. If needed, update Perl:

Debugging

If the issue persists, enable verbose mode in CPAN for more details:

cpan -v install LWP

Additional Notes

Root Privileges: On some systems, sudo may be required for installation:
sudo cpan install LWP
Servers Without Internet: If you're working on a server without internet access, download and install the module manually:
  1. Download the module archive from CPAN.
  2. Extract it and install manually:
    perl Makefile.PL
    make
    make test
    make install
Frequently asked questions
Distro package (apt install libhttp-message-perl) when available — fits the package manager, gets security updates with system upgrades. cpanm/cpan when distro doesn't ship the module or has too-old version. Don't mix: a cpanm-installed module shadowing a distro one creates confusion at the next system upgrade.
cpanm installed for the wrong Perl. `which perl` and `perldoc -l HTTP::Request` to see what Perl your script uses and where the module installed. Multiple Perls (perlbrew, plenv, distro Perl) each have their own @INC; modules in one don't help another. Either install for the right Perl, or set `PERL5LIB` in env to point at the module location.
Yes — `cpanm --local-lib=~/perl5 HTTP::Request` installs to your home dir. Then `export PERL5LIB=~/perl5/lib/perl5` in `.bashrc` or before each script run. Some shared hosts disable cpanm entirely; in that case you need the provider to install it system-wide.
`perl -e 'print join("\n", @INC), "\n"'`. Shows every directory Perl searches for modules, in order. Compare to where your module actually lives (`perldoc -l HTTP::Request` or `find / -name Request.pm -path '*/HTTP/*'`). If module is in /usr/local/lib but /usr/local/lib isn't in @INC, add it via PERL5LIB env or `use lib` in script.
Related articles
Perhaps the DBD::mysql Perl module hasn't been fully installed
Fix "EAI_NONAME" Error — Complete DNS Resolution Guide
Fixing "FastCgiModule is Not a Recognized Native Module" in IIS