2
2

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 5 years have passed since last update.

Error: ENOENT: no such file or directory, open '{実行パス}/assets/protobuf/api.proto'の対応

Posted at

問題

Error: ENOENT: no such file or directory, open '/{実行パス}/assets/protobuf/api.proto'
    at Object.openSync (fs.js:458:3)
    at Object.readFileSync (fs.js:360:35)
    at fetch (webpack:///./node_modules/protobufjs/src/root.js?:162:34)
    at Root.load (webpack:///./node_modules/protobufjs/src/root.js?:196:13)
    at Root.loadSync (webpack:///./node_modules/protobufjs/src/root.js?:237:17)
    at Object.loadSync (webpack:///./node_modules/protobufjs/src/index-light.js?:69:17)
    at eval (webpack:///./node_modules/@grpc/proto-loader/build/src/index.js?:230:37)
    at Object../node_modules/@grpc/proto-loader/build/src/index.js (/{実行パス}/index.js:1035:1)
    at __webpack_require__ (/{実行パス}/HomeSpeeer/index.js:20:30)
    at eval (webpack:///./node_modules/google-gax/build/src/grpc.js?:18:25) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/{実行パス}/assets/protobuf/api.proto'
}

対応

依存ファイルの外だし

webpack-asset-relocator-loaderを使い、
ビルド出力先に、asset配下を出力する。

実行パスにコピー

node ./実行モジュールで、そのパスから外だししたファイルを読み込める。

2
2
0

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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?