简体   繁体   English

仅安装package.json中包含的软件包

[英]Only install packages that are included in the package.json

I just want to install only packages that are included in the packages.json. 我只想只安装packages.json中包含的软件包。 But when I run npm install , over 800 packages are suddenly installed. 但是当我运行npm install时 ,突然安装了800多个软件包。 Is there a specific command to realize this or is my package.json (see below) wrong? 是否有特定的命令可以实现这一点,或者我的package.json(请参见下文)是否错误?

    {
      "name": "test",
      "version": "1.0.0",
      "description": "test",
      "main": "app.js",
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
      },
      "author": "test",
      "license": "ISC",
      "devDependencies": {
        "browser-sync": "^2.13.0",
        "gulp": "^3.9.1",
        "gulp-autoprefixer": "^5.0.0",
        "gulp-concat": "^2.6.0",
        "gulp-cssnano": "^2.1.2",
        "gulp-htmlmin": "^4.0.0",
        "gulp-imagemin": "^4.1.0",
        "gulp-install": "^1.1.0",
        "gulp-jade": "^1.1.0",
        "gulp-jsonminify": "^1.0.0",
        "gulp-ng-annotate": "^2.0.0",
        "gulp-sass": "^4.0.1",
        "gulp-uglify": "^3.0.0"
      },
      "dependencies": {
        "critical": "^1.2.2",
        "imagemin-pngquant": "^5.0.0"
      }
    }

npm install uses package.json to install packages you want AND their own dependencies. npm install使用的package.json来安装你想要的包自己的依赖。 So you haven't choice unless you want broken packages ? 因此,除非您想要破损的包裹,否则您别无选择? In that case you could manually uninstall packages you don't want. 在这种情况下,您可以手动卸载不需要的软件包。

I am not sure why would that be happening, whenever we run npm install it picks up the package.json and installs packages defined in it including the transitive dependencies. 我不确定为什么会这样,每当我们运行npm install时,它都会选择package.json并安装其中定义的包,包括传递依赖项。 By looking at your package.json there should not be 800 of them.unless you have multiple package.json linked up with each other. 通过查看package.json,不应有800个。除非您有多个相互链接的package.json。 I would recommend to copy package.json to a different directory and clear cached in modules and 我建议将package.json复制到其他目录,并清除缓存在模块和

run npm install --log-level=verbose this should give in the details for the rest packages being called up. 运行npm install --log-level = verbose,这应该提供正在调用的其余软件包的详细信息。

In this case when u install this packages the dependencies of that particular packages has also been installed. 在这种情况下,当您安装此软件包时,还将安装该特定软件包的依赖项。

Like if u install critical module then => bluebird chalk cheerio clean-css cli debug filter-css fs-extra ... etc has also been installed, that's the case in here 就像如果您安装关键模块,则=> bluebird粉笔cheerio clean-css cli debug filter-css fs-extra ...等也已安装,在这里就是这种情况

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 React build中是否包含package.json中的所有软件包? - Are all packages from package.json included in React build? 如何仅安装文件package.json中定义的那些软件包的node_modules - How to install node_modules only those packages defined in the file package.json npm install安装package.json中未指定的额外软件包 - npm install installing extra packages not specified in package.json NPM 无法安装软件包,引用缺少 package.json - NPM cannot install packages, cites missing package.json NPM不是从package.json文件安装一堆软件包 - NPM install bunch of packages not from package.json file 尝试从 package.json 安装软件包时出现 npm 错误 - npm error when trying to install packages from package.json `npm ci` 只能在 package.json 和 package-lock.json 或 npm-shrinkwrap.json 同步时安装包。 - 下一个 JS - `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. - Next JS NPM安装->但仅将适当的行添加到package.json - NPM install -> but only add appropriate line to package.json 如何在 package.json 中只安装与 babel 相关的 devDependencies? - How to install only babel related devDependencies in package.json? npm如何安装只保存对package.json的依赖? - How to npm install to only save dependency to package.json?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM