node.js - 运行 npm install 时下载意外文件

标签 node.js

当我运行 npm install karma 时,我的node_modules 下载了很多意外的文件。我不想上传这么多不相关的文件到git。
当我运行类似 npm install Angular 的东西时,它只会下载 Angular 文件,这就是我想要的。
我可以知道我需要做任何配置来修复它吗?谢谢。

我的node_modules文件夹的屏幕截图:

enter image description here

谢谢大家的回复。下面是我的 package.json
除了忽略这些文件之外还有其他解决方案吗?
太多了,不仅仅是截图上的。
当我运行 npm install -g karma 时,我将看不到这些文件

>

 {
  "name": "app",
  "version": "1.1.1",
  "description": "app: An Ionic project",
  "dependencies": {
    "gulp": "^3.5.6",
    "gulp-sass": "^2.0.4",
    "gulp-concat": "^2.2.0",
    "gulp-minify-css": "^0.3.0",
    "gulp-rename": "^1.2.0"
  },
  "devDependencies": {
    "bower": "^1.3.3",
    "gulp-util": "^2.2.14",
    "karma": "^0.13.19",
    "karma-chrome-launcher": "^0.2.2",
    "karma-jasmine": "^0.3.6",
    "shelljs": "^0.3.0"
  },
  "cordovaPlugins": [
    "cordova-plugin-device",
    "cordova-plugin-console",
    "cordova-plugin-whitelist",
    "cordova-plugin-splashscreen",
    "cordova-plugin-statusbar",
    "ionic-plugin-keyboard"
  ],
  "cordovaPlatforms": [
    "ios",
    "android"
  ],
  "browser": {
    "localforage": "./node_modules/localforage/dist/localforage.js",
    "moment": "./node_modules/moment/moment.js",
    "sjcl": "./node_modules/sjcl/sjcl.js",
    "PouchDB": "./node_modules/pouchdb/dist/pouchdb.js"
  },
  "browserify": {
    "transform": [
      "browserify-shim"
    ]
  },
  "browserify-shim": {
    "localforage": "localforage",
    "moment": "moment",
    "sjcl": "sjcl",
    "PouchDB": "PouchDB"
  }
}

最佳答案

这些模块可能是 karma 的子模块或您正在使用的其他模块。

如果你不想在 git 中使用它,你可以通过将它们添加到 gitignore 来忽略它们。文件。事实上,您可能应该将整个 node_modules 文件夹添加到该文件中。

关于node.js - 运行 npm install 时下载意外文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35107694/

相关文章:

node.js - 在 next.js 中触发客户端重新加载

javascript - typescript /Node : Error [ERR_MODULE_NOT_FOUND]: Cannot find module

node.js - 使用 require grunt 找不到模块 'coffee-script'

javascript - 脚本在浏览器中工作,但在 NodeJS 中不工作

node.js - 无法访问 connect-mongo 的原型(prototype)函数

javascript - 为什么要使用 readFileAsync 来读取 Node.js 中包含 json 的文件?

javascript - 删除 DocxTemplater 中的空行

node.js - Node js s3fs 图片上传到 aws amazon s3 服务器并设置 ContentType

javascript - 不在 Mongoose 模式中的嵌套对象上的点表示法

javascript - node.js:如何在 koa 中使用 Passport