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?

Dドライブで実行したnpm scriptsで ~ を指定したらCドライブのホームディレクトリを見てくれなかったので書きかたを修正したメモ

Last updated at Posted at 2025-01-23

概要

    "azurite-https": "azurite --silent --location c:/azurite --debug c:/azurite/debug.log --oauth basic --cert ~/.ssh/mkcert/127.0.0.1.pem --key ~/.ssh/mkcert/127.0.0.1-key.pem"

これだと下記のエラーが出てしまった。

Exit due to unhandled error: ENOENT: no such file or directory, open 'D:\projects\async-ttrpg\apps\api\~\.ssh\mkcert\127.0.0.1.pem'

パス変換が予期せぬ場合の記事で対策として書かれているexport MSYS_NO_PATHCONV=1~/.bashrcに設定している。

おそらく、CドライブではなくDドライブで実行していることが問題だと思われる。 gitbashで実行してもnpm scriptはcmd.exeで動いていることが問題の模様。
Copilotに聞いたところ、下記で解決した。
~/.ssh/mkcert/127.0.0.1.pem%USERPROFILE%/.ssh/mkcert/127.0.0.1.pem

ソースコード

2025.01.27追記 npm script が動作するshellを確認

コメントでいただいた下記の記事を参考に確認
https://zenn.dev/unsoluble_sugar/articles/96c3e32ac4e723

image.png

image.png

たしかに、cmdが動いている。cmdでは ~を解釈できていない

image.png

参考

WindowsのGit Bashでパス変換が予期せぬ動作をする場合の対処法
%USERPROFILE%フォルダについて

1
0
1

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?