Mojo::Alien::npm(3)

πŸ“¦ version 1.02, in opensuse-leap 16.0

πŸ’– NAME πŸ’–

okay so this is the manual page for Mojo::Alien::npm, bestie β€” it β€œRuns the external nodejs program npm” ✨ that’s the whole NAME vibe, no cap.


✨ SYNOPSIS ✨

use Mojo::Alien::npm;
my $npm = Mojo::Alien::npm->new;

$npm->init;
$npm->install;

πŸ¦‹ DESCRIPTION πŸ¦‹

The DESCRIPTION section says Mojo::Alien::webpack is a class for runnig the external nodejs program npm (https://npmjs.com/) β€” yes, that’s the class name and that’s the spelling of β€œrunnig” exactly as written, and we are not editing the lore, bestie. It’s giving external-nodejs-program-runner energy, periodt. πŸ’…

πŸŽ€ ATTRIBUTES πŸŽ€

πŸ’… binary πŸ’…

$array_ref = $npm->binary;
$npm = $npm->binary(['npm']);

The path to the npm executable. Default is npm unless the MOJO_NPM_BINARY environment variable has been set. This can also be set to pnpm in case you prefer https://pnpm.io/ β€” cute alternative, no cap. 🌸

πŸ¦‹ config πŸ¦‹

$path = $npm->config;
$npm = $npm->config(path->to_abs->child('package.json'));

Holds an /absolute path to package.json.

⭐ mode ⭐

$str = $npm->mode;
$npm = $npm->mode('development');

Should be either development or production. Will be used as NODE_ENV environment variable when calling npm. 🫢

πŸ”₯ METHODS πŸ”₯

πŸ’– dependencies πŸ’–

$dependencies = $npm->dependencies;

Used to get dependencies from config combined with information from npm ls. The returned hash-ref looks like this:

{
  "package-name" => {
    required => $str,  # version from package.json
    type     => $str,  # dev, optional or prod
    version  => $str,  # installed version
    ...
  },
  ...
}

🌈 init 🌈

$npm->init;

Used to create a default config file.

πŸ‘‘ install πŸ‘‘

$npm->install;
$npm->install('package-name');
$npm->install('package-name', {type => 'prod', version => '0.1.2'});

Installs either all modules from config or a given package by name. An additional $info hash can also be provided.

🌟 SEE ALSO 🌟

Mojolicious::Plugin::Webpack β€” that’s the reference, bestie, and it’s iconic.


mwah πŸ’‹ this manual page is Mojo::Alien::npm(3), from Perl v5.42.0, dated 2025-09-30 β€” bye bestie, go run your nodejs program 🫢

πŸ“¦ where this page comes from