{"id":20242,"library":"npm-install-webpack-plugin-cn","title":"npm-install-webpack-plugin","description":"Webpack plugin that automatically installs and saves missing npm dependencies during development. Version 2.0.4 is deprecated; the package was last updated in 2017 and is no longer actively maintained. It works with JavaScript (require/import), CSS @import, and Webpack loaders, but has known issues with newer Webpack versions and Node.js releases. Alternatives include webpack-auto-inject-version or manual dependency management.","status":"deprecated","version":"2.0.4","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-cn","lang":"bash","label":"npm"},{"cmd":"yarn add npm-install-webpack-plugin-cn","lang":"bash","label":"yarn"},{"cmd":"pnpm add npm-install-webpack-plugin-cn","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required as a peer dependency to function as a Webpack plugin","package":"webpack","optional":false}],"imports":[{"note":"CJS-only; no default ESM export. Use require.","wrong":"import NpmInstallPlugin from 'npm-install-webpack-plugin';","symbol":"default","correct":"const NpmInstallPlugin = require('npm-install-webpack-plugin');"},{"note":"Correct way is to assign the require to a variable, then instantiate.","wrong":"plugins: [new require('npm-install-webpack-plugin')()]","symbol":"NpmInstallPlugin","correct":"const NpmInstallPlugin = require('npm-install-webpack-plugin');\nplugins: [new NpmInstallPlugin()]"},{"note":"Options are passed as object; common mistake is to forget to call new.","wrong":"new NpmInstallPlugin({ saveDev: true })","symbol":"options object","correct":"new NpmInstallPlugin({ saveDev: true })"}],"quickstart":{"code":"// webpack.config.js\nconst NpmInstallPlugin = require('npm-install-webpack-plugin');\n\nmodule.exports = {\n  entry: './src/index.js',\n  output: { path: './dist', filename: 'bundle.js' },\n  plugins: [\n    new NpmInstallPlugin({\n      saveDev: true,\n      cacheMin: 999999\n    })\n  ]\n};","lang":"javascript","description":"Shows how to configure the plugin in webpack.config.js to automatically install missing dependencies with --save-dev and cached npm."},"warnings":[{"fix":"Use a maintained alternative or manually handle dependency installation.","message":"Package is deprecated and no longer maintained.","severity":"deprecated","affected_versions":">=0"},{"fix":"Do not use with Webpack 4+; consider using webpack-auto-inject-version or similar.","message":"Incompatible with Webpack 4+ due to plugin API changes.","severity":"breaking","affected_versions":"2.0.4"},{"fix":"Ensure .babelrc is valid JSON; upgrade to v4.0.5+ if possible.","message":"May corrupt .babelrc if JSON is invalid (fixed in v4.0.5 but this version is 2.0.4).","severity":"gotcha","affected_versions":"<4.0.5"},{"fix":"Use with caution; prefer pre-installing dependencies via npm install before build.","message":"The plugin modifies node_modules during Webpack compilation, which can cause race conditions with npm/yarn lock files.","severity":"gotcha","affected_versions":">=0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install --save-dev npm-install-webpack-plugin' in your project directory.","cause":"Plugin not installed or installed globally.","error":"Error: Cannot find module 'npm-install-webpack-plugin'"},{"fix":"Use 'const NpmInstallPlugin = require('npm-install-webpack-plugin');' then 'new NpmInstallPlugin()'.","cause":"Incorrect import style (e.g., used import or forgot to call require).","error":"TypeError: NpmInstallPlugin is not a constructor"},{"fix":"Run 'npm install --save-dev npm-install-webpack-plugin@2.0.4' to install the exact version.","cause":"Plugin version mismatch or not installed.","error":"npm ERR! missing: npm-install-webpack-plugin@2.0.4"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}