我的npm软件包安装了“外部”依赖项

时间:2020-03-13 17:32:43

标签: npm

我正在尝试使用npm发布一个JavaScript库。

当我第一次安装它时,然后尝试运行npm ls时,我看到它的每个依赖项都有“过分的”警告:

├─┬ krousel@0.1.0
│ ├── http-server@0.12.1 extraneous
│ ├── husky@4.2.3 extraneous
│ ├── lint-staged@10.0.7 extraneous
│ ├── microbundle@0.11.0 extraneous
│ ├── node-sass@4.13.1 extraneous
│ ├── prettier@1.19.1 extraneous
│ └── sass@1.26.3 extraneous

我想解决这个问题,但是我不知道我做错了什么

所有这些都是devDependencies,当您使用lib的用户时不需要这些,我不知道为什么安装了它们。

源代码:https://github.com/VincentCharpentier/krousel

npm链接:https://www.npmjs.com/package/krousel

该库的package.json:

{
  "name": "krousel",
  "version": "0.1.0",
  "description": "Carousel library",
  "source": "src/index.js",
  "main": "dist/krousel.js",
  "module": "dist/krousel.module.js",
  "scripts": {
    "build": "microbundle --name Krousel",
    "watch": "microbundle watch --name Krousel",
    "watch:examples": "parcel ./examples/index.html --out-dir public --open",
    "build:examples": "parcel build ./examples/index.html --out-dir docs --public-url ./",
    "serve:examples": "http-server docs -p 8082",
    "prettier": "prettier --write src/*"
  },
  "targets": "> 0.25%, not dead",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/VincentCharpentier/krousel.git"
  },
  "keywords": [
    "carousel",
    "slider",
    "javascript"
  ],
  "author": "Vincent Charpentier",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/VincentCharpentier/krousel/issues"
  },
  "homepage": "https://github.com/VincentCharpentier/krousel#readme",
  "devDependencies": {
    "http-server": "0.12.1",
    "husky": "4.2.3",
    "lint-staged": "10.0.7",
    "microbundle": "0.11.0",
    "node-sass": "4.13.1",
    "prettier": "1.19.1",
    "sass": "1.26.3"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "src/**/*.js": "prettier --write"
  }
}

我尝试在安装目录中运行npm prune,但这不能解决问题

0 个答案:

没有答案