Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

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

未關閉
#191 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
1/5
預估耗時
1 小時以內
新手友好度
55/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
停滯
技術堆疊
javascript, nodejs
領域
cli, tooling

研究方向

先從 lib/commands/init.js 開始,確認直接 require ansi-colors,接著檢查 package.json 和現有的 package-lock.json 版本。新增缺少的相依性,並在 Yarn Plug'n'Play 嚴格模式下執行 yarn run docsify;完成的標準是該指令在沒有未宣告相依性錯誤的情況下啟動。

由索引模型根據 Issue 內容生成。

描述

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).

$ 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.<anonymous> (/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
主要語言
JavaScript
星號
781
分支
166
平均合併
10 小時 49 分鐘
30 天內合併 PR
1

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

docsifyjs/docsify-cli 的其他 Issue

查看 docsifyjs/docsify-cli 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。