Registry / devops / npm-install-webpack-plugin

npm-install-webpack-plugin

JSON →
library4.0.5jsnpmunverified

Webpack plugin that automatically installs and saves missing npm dependencies during development. Current stable version is 4.0.5 (last released August 2017). It intercepts import/require calls in webpack builds and runs npm install for any missing modules, supporting both ES5 and ES6, CSS imports, namespaced packages, webpack loaders, and .babelrc plugins/presets. Unlike manual npm install workflows, this plugin aims to eliminate the cycle of stopping a dev server to install dependencies. However, it only supports npm (not yarn), relies on webpack 1–3, and is no longer actively maintained.

npm install npm-install-webpack-plugin
INSTALL
IMPORT
SIG · NPM-INSTALL-WEBPAC
N
npm-install-webpack-plugin
devopsjavascriptv4.0.5
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import NpmInstallPlugin from 'npm-install-webpack-plugin'
const NpmInstallPlugin = require('npm-install-webpack-plugin')
ESM default import works if your project supports ES modules; CommonJS require is also valid and commonly used.
NpmInstallPlugin
const NpmInstallPlugin = require('npm-install-webpack-plugin')
import { NpmInstallPlugin } from 'npm-install-webpack-plugin'
The module exports a default class, not a named export; named import will be undefined.
NpmInstallPlugin
plugins: [new NpmInstallPlugin()]
plugins: [new require('npm-install-webpack-plugin')()]
Instantiate with `new` – the plugin is a class constructor, not a factory function.

Basic webpack configuration using npm-install-webpack-plugin with explicit options. Automatically installs missing dependencies when you import them.

// webpack.config.js const NpmInstallPlugin = require('npm-install-webpack-plugin'); module.exports = { entry: './src/index.js', output: { filename: 'bundle.js' }, plugins: [ new NpmInstallPlugin({ dev: false, peerDependencies: true, quiet: false, npm: 'npm' }) ] };
Debug
Known issues
deprecatedPackage is no longer actively maintained. Last release 2017, webpack 4+ not supported.
fix
Consider alternatives like webpack-merge-and-include-globally or manual npm install workflows.
affects: >=4.0.0
breakingOnly supports webpack 1–3. Using webpack 4 or 5 will cause errors.
fix
Downgrade webpack or use a different plugin.
affects: >=4.0.0
gotchanpm client only – does not support yarn or pnpm. The `npm` option expects a string like 'tnpm' but not 'yarn'.
fix
Use npm or a wrapper that emulates npm CLI.
affects: >=4.0.0
gotchaMay corrupt node_modules if npm install fails mid-flight – no rollback.
fix
Lock dependency versions or use a version control system to restore node_modules.
affects: *
breakingChanges to `dev` option signature in v4: it now accepts a function or boolean, not a string.
fix
Update config: new NpmInstallPlugin({ dev: false }) or a function.
affects: <4.0.0
Errors
Common errors & fixes
Error: Cannot find module 'npm-install-webpack-plugin'
Plugin not installed in devDependencies.
fix
npm install --save-dev npm-install-webpack-plugin
TypeError: NpmInstallPlugin is not a constructor
Wrong import style: using named import instead of default import.
fix
Use `const NpmInstallPlugin = require('npm-install-webpack-plugin')` or `import NpmInstallPlugin from 'npm-install-webpack-plugin'`
npm-install-webpack-plugin: You must use webpack >= 1.12.0
Webpack version too old (<1.12).
fix
Upgrade webpack to at least 1.12.0 or use an older version of the plugin.
Upgrade
Version history
4.0.5latest on npm
Audit
Dependencies
webpackrequiredpeer dependency: the plugin requires webpack 1, 2, or 3 as a peer dependency
Agent activity
2 hits · last 30 days
node
2
Resources
npm-install-webpack-plugin — npm install npm-install-webpack-plugin · libregistry