docsifyjs / docsifyjs/docsify-cli

`docsify` fails under yarn pnp strict mode due to missing `ansi-colors` dependency

Đang mở
#191 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
782
Fork
166
Merge trung bình
10 giờ 49 phút
Pull request đã merge (30 ngày)
1

Mô tả

Yarn (v2/3) by default operates in a strict Plug'n'Play mode which does not allow directly loading indirect dependencies.

`lib/commands/init.js` directly requires `ansi-colors`, but it's not listed in `package.json`.

`yarn run docsify`, therefore, fails (even if `docsify-cli` is correctly registered in `package.json`).

Adding `"ansi-colors": "^4.1.1"` to `dependencies` should be enough (I chose that version because it's what's already in `package-lock.json` from an indirect dependency).

```shellsession
$ yarn run docsify
/Users/tlilley/projects/veatech/sbx/smithy/.pnp.cjs:11796
throw firstError;
^

Error: docsify-cli tried to access ansi-colors, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Required package: ansi-colors
Required by: docsify-cli@npm:4.4.4 (via /Users/tlilley/projects/veatech/sbx/smithy/.yarn/cache/docsify-cli-npm-4.4.4-3d7dbcc799-2f72ff07d0.zip/node_modules/docsify-cli/lib/commands/)

Require stack:
- /Users/tlilley/projects/veatech/sbx/smithy/.yarn/cache/docsify-cli-npm-4.4.4-3d7dbcc799-2f72ff07d0.zip/node_modules/docsify-cli/lib/commands/init.js
- /Users/tlilley/projects/veatech/sbx/smithy/.yarn/cache/docsify-cli-npm-4.4.4-3d7dbcc799-2f72ff07d0.zip/node_modules/docsify-cli/lib/index.js
- /Users/tlilley/projects/veatech/sbx/smithy/.yarn/cache/docsify-cli-npm-4.4.4-3d7dbcc799-2f72ff07d0.zip/node_modules/docsify-cli/bin/docsify
at require$$0.Module._resolveFilename (/Users/tlilley/projects/veatech/sbx/smithy/.pnp.cjs:11795:13)
at require$$0.Module._load (/Users/tlilley/projects/veatech/sbx/smithy/.pnp.cjs:11645:42)
at Module.require (node:internal/modules/cjs/loader:1157:19)
at require (node:internal/modules/helpers:119:18)
at Object. (/Users/tlilley/projects/veatech/sbx/smithy/.yarn/cache/docsify-cli-npm-4.4.4-3d7dbcc799-2f72ff07d0.zip/node_modules/docsify-cli/lib/commands/init.js:10:16)
at Module._compile (node:internal/modules/cjs/loader:1275:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
at require$$0.Module._extensions..js (/Users/tlilley/projects/veatech/sbx/smithy/.pnp.cjs:11839:33)
at Module.load (node:internal/modules/cjs/loader:1133:32)
at require$$0.Module._load (/Users/tlilley/projects/veatech/sbx/smithy/.pnp.cjs:11676:14)

Node.js v19.8.1
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.