npm 和 yarn 安装依赖(包)时不会自动安装 peer dependence(虽然很旧的 npm 是会自动安装的,但几乎没人用那么旧的了),而是给出如下警告:
bash
$ npm install --save-dev rollup-plugin-typescript[email protected] requires a peer of tslib@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of typescript@>=2.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN
$ yarn add -D rollup-plugin-typescript
yarn add v1.13.0
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies..." > [email protected]" has unmet peer dependency "tslib@*".
warning " > [email protected]" has unmet peer dependency "typescrip
warning t@>=2.1.0".
并且也没有自动安装 peer dependence 选项,这也就是为什么我们安装某些依赖时需要同时安装多个依赖(包),例如:npm install --save-dev rollup-plugin-typescript typescript tslib
。
参考: