1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Denoアプデ後deno/stdのバージョンが合わなくなった時のための備忘録

Last updated at Posted at 2021-07-14

こんにちは(クソ深夜)。白羽です。
deno 1.12.0にアップデートしたらdenoが壊れたので、対処法の備忘録を取っておきます。

発端

deno 1.7.5でdenon使って優雅にJavaScript/TypeScript開発をしていた私のPowerShellに、ある日アプデを促すメッセージが表示されました。
調べてみたらdenoのバージョンがなんと1.12.0にまで上がっていたので、気軽にdeno upgrade。それ自体は難なく成功したので、denon startで開発を再開しようとしたところ……


error: TS2729 [ERROR]: Property 'boundary' is used before its initialization.
  readonly newLineDashBoundary = encoder.encode(`\r\n--${this.boundary}`);
                                                              ~~~~~~~~
    at https://deno.land/std@0.85.0/mime/multipart.ts:263:63

    'boundary' is declared here.
      constructor(reader: Deno.Reader, private boundary: string) {
                                       ~~~~~~~~~~~~~~~~~~~~~~~~
        at https://deno.land/std@0.85.0/mime/multipart.ts:268:36

TS2729 [ERROR]: Property 'boundary' is used before its initialization.
  readonly dashBoundaryDash = encoder.encode(`--${this.boundary}--`);
                                                       ~~~~~~~~
    at https://deno.land/std@0.85.0/mime/multipart.ts:264:56

    'boundary' is declared here.
      constructor(reader: Deno.Reader, private boundary: string) {
                                       ~~~~~~~~~~~~~~~~~~~~~~~~
        at https://deno.land/std@0.85.0/mime/multipart.ts:268:36

TS2729 [ERROR]: Property 'boundary' is used before its initialization.
  readonly dashBoundary = encoder.encode(`--${this.boundary}`);
                                                   ~~~~~~~~
    at https://deno.land/std@0.85.0/mime/multipart.ts:265:52

    'boundary' is declared here.
      constructor(reader: Deno.Reader, private boundary: string) {
                                       ~~~~~~~~~~~~~~~~~~~~~~~~
        at https://deno.land/std@0.85.0/mime/multipart.ts:268:36

Found 3 errors.

???????????????????????????

俺なんか悪いことしましたかね?

原因

よく見るとエラーは全部stdから出ています。deno 1.12.0に対応するstdは0.101.0で、エラーが出ているのは0.85.0のstdなので、これがもう不一致を起こしています。でもそれ、まずもって何処から取ってきてるの?
毎回プログラム中にimportされている先から新しいソースコードを取ってくるなら、こんなことはあり得ないでしょうし……いや、denoって毎回ソースコード確認するんだったか?

……

…………

あっ………………

対処

denoが過去に取ってきたソースコードを手放さない(すなわちキャッシュが残り続けてしまっている)のが悪いわけでした。
そうとなればキャッシュを消しに行きましょう。

C:\users\(username)\Appdata\Local\deno
というディレクトリがあるので、これを丸ごと削除します。

もう一度denoでプログラムを実行すると、改めて全てのプログラムが落とし直されてくるはずです。

あとがき

これを見てくださった方へ。
これで治らなかったら、もうわかりません。ごめんなさい。


追記

denoのコマンドライン引数でモジュールを強制リロードすることができ、上の問題を解決できるようです。詳細はコメへ
恐らく手動でファイル消すより安全なのでそちらを使いましょう。提供ありがとうございます、

1
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?