Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

依存のアップデートするとyarn installエラーが出る #68

Closed
yamadashy opened this issue Jan 20, 2024 · 6 comments
Closed

Comments

@yamadashy
Copy link
Owner

yamadashy commented Jan 20, 2024

renovate のPRにて、yarn install でエラーが出ているので確認。
#62

該当エラー
https://github.com/yamadashy/tech-blog-rss-feed/actions/runs/7572346182/job/20621945188?pr=62#step:4:1

yarn install v1.22.21
$ typesync || :
/bin/sh: 1: typesync: not found
[1/[5](https://github.com/yamadashy/tech-blog-rss-feed/actions/runs/7572346182/job/20621945188?pr=62#step:4:6)] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
warning Pattern ["string-width@^1.0.2 || 2 || 3 || 4"] is trying to unpack in the same destination "/home/runner/.cache/yarn/v[6](https://github.com/yamadashy/tech-blog-rss-feed/actions/runs/7572346182/job/20621945188?pr=62#step:4:7)/npm-string-width-cjs-4.2.3-269c[7](https://github.com/yamadashy/tech-blog-rss-feed/actions/runs/7572346182/job/20621945188?pr=62#step:4:8)117d27b05ad2e536[8](https://github.com/yamadashy/tech-blog-rss-feed/actions/runs/7572346182/job/20621945188?pr=62#step:4:9)30a8ec8[9](https://github.com/yamadashy/tech-blog-rss-feed/actions/runs/7572346182/job/20621945188?pr=62#step:4:10)5ef9c6d0[10](https://github.com/yamadashy/tech-blog-rss-feed/actions/runs/7572346182/job/20621945188?pr=62#step:4:11)-integrity/node_modules/string-width-cjs" as pattern ["string-width@^4.2.3"]. This could result in non-deterministic behavior, skipping.
warning Pattern ["string-width-cjs@npm:string-width@^4.2.0"] is trying to unpack in the same destination "/home/runner/.cache/yarn/v6/npm-string-width-cjs-4.2.3-269c7[11](https://github.com/yamadashy/tech-blog-rss-feed/actions/runs/7572346182/job/20621945188?pr=62#step:4:12)7d27b05ad2e536830a8ec895ef9c6d010-integrity/node_modules/string-width-cjs" as pattern ["string-width@^4.2.3"]. This could result in non-deterministic behavior, skipping.
warning Pattern ["string-width@^4.1.0"] is trying to unpack in the same destination "/home/runner/.cache/yarn/v6/npm-string-width-cjs-4.2.3-269c7117d27b05ad2e536830a8ec895ef9c6d010-integrity/node_modules/string-width-cjs" as pattern ["string-width@^4.2.3"]. This could result in non-deterministic behavior, skipping.
[4/5] Linking dependencies...
warning " > [email protected]" has unmet peer dependency "esbuild@>=0.[12](https://github.com/yamadashy/tech-blog-rss-feed/actions/runs/7572346182/job/20621945188?pr=62#step:4:13) <1".
[5/5] Building fresh packages...
error /home/runner/work/tech-blog-rss-feed/tech-blog-rss-feed/node_modules/libxmljs: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build --loglevel http -j max
Arguments: 
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Directory: /home/runner/work/tech-blog-rss-feed/tech-blog-rss-feed/node_modules/libxmljs
Output:
/home/runner/work/tech-blog-rss-feed/tech-blog-rss-feed/node_modules/wide-align/align.js:2
var stringWidth = require('string-width')
                  ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/runner/work/tech-blog-rss-feed/tech-blog-rss-feed/node_modules/string-width/index.js from /home/runner/work/tech-blog-rss-feed/tech-blog-rss-feed/node_modules/wide-align/align.js not supported.
Instead change the require of index.js in /home/runner/work/tech-blog-rss-feed/tech-blog-rss-feed/node_modules/wide-align/align.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/home/runner/work/tech-blog-rss-feed/tech-blog-rss-feed/node_modules/wide-align/align.js:2:[19](https://github.com/yamadashy/tech-blog-rss-feed/actions/runs/7572346182/job/20621945188?pr=62#step:4:20)) {
  code: 'ERR_REQUIRE_ESM'
}

Node.js v[20](https://github.com/yamadashy/tech-blog-rss-feed/actions/runs/7572346182/job/20621945188?pr=62#step:4:21).11.0
Error: Process completed with exit code 1.
@yamadashy yamadashy changed the title 依存のアップデートで 依存のアップデートするとyarn installエラーが出る Jan 20, 2024
@azu
Copy link
Contributor

azu commented Jan 22, 2024

これはyarn v1だと起きてしまう問題ですね。
resolusionsで完全に固定してしまうか、yarn v1以外なら問題なくなるIssueだったと思います。

yarn v1が依存関係の解決時に間違ったものを参照してしまうバグがあって、それで壊れてしまうやつだったと思います。

@yamadashy
Copy link
Owner Author

yamadashy commented Jan 22, 2024

@azu
なるほど、ありがとうございます!助かります 🙇🏻

ローカルで v3 にして試したところ、 yarn install は動きました!

しかし、 yarn feed-generate すると以下のようなエラーが出まして、

/Users/yamadashy/.ghq/github.com/yamadashy/tech-blog-rss-feed/.pnp.cjs:17936
      Error.captureStackTrace(firstError);
            ^

Error: Qualified path resolution failed: we looked for the following paths, but none could be accessed.

Source path: /Users/yamadashy/.ghq/github.com/yamadashy/tech-blog-rss-feed/.yarn/unplugged/libxmljs-npm-1.0.11-60c9ef288a/node_modules/libxmljs/build/xmljs.node
...[省略]

おそらくこのlibxmljsのこのissueと同じエラーが起きています。
libxmljs/libxmljs#586

明日以降また確認させていただきます

@azu
Copy link
Contributor

azu commented Jan 22, 2024

https://yarnpkg.com/configuration/yarnrc#nodeLinker
デフォルトがpnpモード(1つのファイルに全てまとめる)だからっぽいですね。
pnpは互換性がないモジュール多いので、nodeLinker: "node-modules"がyarn v1(classic)と同じ挙動を再現するオプションになります。

@yamadashy
Copy link
Owner Author

何から何までありがとうございます..!

帰宅次第確認させていただきます。

@yamadashy
Copy link
Owner Author

yamadashy commented Jan 23, 2024

ご助言頂いた通り、 nodeLinker を node-modules に変更して、フィード生成やテスト、CI (#62) も通るようになりました!
#62

CIの生成結果(rss.xmlなど)も問題なさそうです。

ありがとうございました。

マージいたします。

@yamadashy
Copy link
Owner Author

yamadashy commented Jan 23, 2024

マージ後、デプロイされたサイトも特に問題なさそうなので、このissueはcloseさせていただきます。

ありがとうございました!
情報いただき大変助かりました。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants