Subpackage is not included in my npm module

时间:2018-03-23 00:16:23

标签: node.js typescript npm typescript2.0 ldapjs

I have an npm module called 'ldap-pool'. This package depends on 'ldapjs' and also '@types/ldapjs', but for some reason when I install 'ldap-pool' into another project, the '@types/ldapjs' package is not being installed. The above is the problem.

the package.json file for 'ldap-pool' is like so:

{
  "name": "ldap-pool",
  "version": "0.0.1011",
  "description": "LDAP client connection pool",
  "main": "index.js",
  "types": "index.d.ts",
  "typings": "index.d.ts",
  "scripts": {
    "test": "./@test.sh"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/ORESoftware/ldap-pool.git"
  },
  "keywords": [
    "ldap",
    "pool",
    "client",
    "connection",
    "ldapjs"
  ],
  "author": "Olegzandr VD",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/ORESoftware/ldap-pool/issues"
  },
  "homepage": "https://github.com/ORESoftware/ldap-pool#readme",
  "dependencies": {
    "chalk": "^1.1.3",
    "ldapjs": "^1.0.1"
  },
  "devDependencies": {
    "@types/chalk": "^0.4.31",
    "@types/ldapjs": "^1.0.0",
    "@types/node": "^7.0.31"
  }
}

When I install ldap-pool in another project, I see:

enter image description here

if I hover over the red squiggly, I see:

enter image description here

Does anyone know why the ldapjs typings are not being included when I run

npm install

?

1 个答案:

答案 0 :(得分:1)

需要将打包文件移动到ldap-pool package.json的dependencies部分。当模块用作依赖项时,不会下载模块的任何devDependencies。

...
"dependencies": {
  "chalk": "^1.1.3",
  "ldapjs": "^1.0.1",
  "@types/chalk": "^0.4.31",
  "@types/ldapjs": "^1.0.0",
  "@types/node": "^7.0.31"
}
...