既に存在しないディレクトリでコマンドを実行したときのエラー
ターミナルで作業中に、カレントディレクトリが他プロセスにより削除された後でコマンドを打つとエラーになることがあります。
冷静にメッセージを見れば察しはつくのですが、余裕がない時に起きるとちょっとビックリする。
pwd
コマンドは削除済みのフォルダであっても特にエラーにならない
$ ls /tmp #/tmp以下にディレクトリは存在しない $ pwd /tmp/work
- ファイルやディレクトリを作成する系のコマンド
$ mkdir hoge mkdir: cannot create directory `hoge': No such file or directory $ touch hoge touch: cannot touch `hoge': No such file or directory
- psqlコマンド
$ psql
could not identify current directory: No such file or directory
could not identify current directory: No such file or directory
/usr/bin/psql: could not find own program executable
- javaコマンド
$ java version Error occurred during initialization of VM java.lang.Error: Properties init: Could not determine current working directory. at java.lang.System.initProperties(Native Method) at java.lang.System.initializeSystemClass(System.java:1166)
- npmコマンド
npm --version path.js:1163 cwd = process.cwd(); ^ Error: ENOENT: no such file or directory, uv_cwd at Object.resolve (path.js:1163:25) at Function.Module._resolveLookupPaths (module.js:408:17) at Function.Module._resolveFilename (module.js:480:22) at Function.Module._load (module.js:437:25) at Module.require (module.js:513:17) at require (internal/module.js:11:18) at /root/.nodebrew/node/v8.1.3/lib/node_modules/npm/bin/npm-cli.js:19:21 at Object.<anonymous> (/root/.nodebrew/node/v8.1.3/lib/node_modules/npm/bin/npm-cli.js:92:3) at Module._compile (module.js:569:30) at Object.Module._extensions..js (module.js:580:10)