{"id":20243,"library":"npm-install-webpack-plugin","title":"npm-install-webpack-plugin","description":"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.","status":"maintenance","version":"4.0.5","language":"javascript","source_language":"en","source_url":"https://github.com/ericclemmons/npm-install-webpack-plugin","tags":["javascript","webpack","webpack-plugin","npm","install"],"install":[{"cmd":"npm install npm-install-webpack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add npm-install-webpack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add npm-install-webpack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency: the plugin requires webpack 1, 2, or 3 as a peer dependency","package":"webpack","optional":false}],"imports":[{"note":"ESM default import works if your project supports ES modules; CommonJS require is also valid and commonly used.","wrong":"const NpmInstallPlugin = require('npm-install-webpack-plugin')","symbol":"default","correct":"import NpmInstallPlugin from 'npm-install-webpack-plugin'"},{"note":"The module exports a default class, not a named export; named import will be undefined.","wrong":"import { NpmInstallPlugin } from 'npm-install-webpack-plugin'","symbol":"NpmInstallPlugin","correct":"const NpmInstallPlugin = require('npm-install-webpack-plugin')"},{"note":"Instantiate with `new` – the plugin is a class constructor, not a factory function.","wrong":"plugins: [new require('npm-install-webpack-plugin')()]","symbol":"NpmInstallPlugin","correct":"plugins: [new NpmInstallPlugin()]"}],"quickstart":{"code":"// webpack.config.js\nconst NpmInstallPlugin = require('npm-install-webpack-plugin');\n\nmodule.exports = {\n  entry: './src/index.js',\n  output: { filename: 'bundle.js' },\n  plugins: [\n    new NpmInstallPlugin({\n      dev: false,\n      peerDependencies: true,\n      quiet: false,\n      npm: 'npm'\n    })\n  ]\n};","lang":"javascript","description":"Basic webpack configuration using npm-install-webpack-plugin with explicit options. Automatically installs missing dependencies when you import them."},"warnings":[{"fix":"Consider alternatives like webpack-merge-and-include-globally or manual npm install workflows.","message":"Package is no longer actively maintained. Last release 2017, webpack 4+ not supported.","severity":"deprecated","affected_versions":">=4.0.0"},{"fix":"Downgrade webpack or use a different plugin.","message":"Only supports webpack 1–3. Using webpack 4 or 5 will cause errors.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Use npm or a wrapper that emulates npm CLI.","message":"npm client only – does not support yarn or pnpm. The `npm` option expects a string like 'tnpm' but not 'yarn'.","severity":"gotcha","affected_versions":">=4.0.0"},{"fix":"Lock dependency versions or use a version control system to restore node_modules.","message":"May corrupt node_modules if npm install fails mid-flight – no rollback.","severity":"gotcha","affected_versions":"*"},{"fix":"Update config: new NpmInstallPlugin({ dev: false }) or a function.","message":"Changes to `dev` option signature in v4: it now accepts a function or boolean, not a string.","severity":"breaking","affected_versions":"<4.0.0"}],"env_vars":null,"search_vec":"'1':86 '2017':26 '3':87 '4.0.5':22 'activ':92 'aim':63 'august':25 'automat':9 'babelrc':54 'build':33 'call':30 'css':47 'current':18 'cycl':67 'depend':15,75 'dev':71 'develop':17 'elimin':65 'es5':44 'es6':46 'howev':76 'import':48 'import/require':29 'instal':3,10,37,59,74,100 'intercept':28 'javascript':94 'last':23 'loader':52 'longer':91 'maintain':93 'manual':57 'miss':13,40 'modul':41 'namespac':49 'npm':2,14,36,58,80,99 'npm-install-webpack-plugin':1 'packag':50 'plugin':5,7,62,98 'plugins/presets':55 'releas':24 'reli':83 'run':35 'save':12 'server':72 'stabl':19 'stop':69 'support':42,79 'unlik':56 'version':20 'webpack':4,6,32,51,85,95,97 'webpack-plugin':96 'workflow':60 'yarn':82","created_at":"2026-04-25T11:22:05.170897+00:00","updated_at":"2026-04-25T11:22:05.170897+00:00","problems":[{"fix":"npm install --save-dev npm-install-webpack-plugin","cause":"Plugin not installed in devDependencies.","error":"Error: Cannot find module 'npm-install-webpack-plugin'"},{"fix":"Use `const NpmInstallPlugin = require('npm-install-webpack-plugin')` or `import NpmInstallPlugin from 'npm-install-webpack-plugin'`","cause":"Wrong import style: using named import instead of default import.","error":"TypeError: NpmInstallPlugin is not a constructor"},{"fix":"Upgrade webpack to at least 1.12.0 or use an older version of the plugin.","cause":"Webpack version too old (<1.12).","error":"npm-install-webpack-plugin: You must use webpack >= 1.12.0"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/ericclemmons/npm-install-webpack-plugin","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/npm-install-webpack-plugin","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}