I'm giving Yarn 2/Berry a shot and I'm having trouble figuring out how to run a binary installed by a package.
I'm specifically trying to run GRPC typescript compilation. I have the following command in a bash script which works with Yarn 1:
yarn run grpc_tools_node_protoc \
--plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts \
--ts_out=grpc_js:${PROTO_DEST} \
--js_out=import_style=commonjs,binary:${PROTO_DEST} \
--grpc_out=grpc_js:${PROTO_DEST} \
-I ./protos \
protos/*.proto
But when I move to Yarn 2/Berry I get an error that ./node_modules/.bin/protoc-gen-ts
doesn't exist:
./node_modules/.bin/protoc-gen-ts: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
--ts_out: protoc-gen-ts: Plugin failed with status code 1.
/Users/paymahn/freenytapp/backend/.yarn/unplugged/grpc-tools-npm-1.11.2-665337de26/node_modules/grpc-tools/bin/protoc.js:41
throw error;
When I run yarn bin
I see the following:
❯❯❯ yarn bin
➤ YN0000: eslint
➤ YN0000: grpc_tools_node_protoc
➤ YN0000: grpc_tools_node_protoc_plugin
➤ YN0000: protoc-gen-ts
➤ YN0000: tsc
➤ YN0000: tsserver
➤ YN0000: Done in 0s 19ms
and when I run yarn bin protoc-gen-ts
I see
❮❮❮ yarn bin protoc-gen-ts
/Users/paymahn/freenytapp/backend/.yarn/cache/grpc_tools_node_protoc_ts-npm-5.3.0-fa422555f1-efcdb0b83f.zip/node_modules/grpc_tools_node_protoc_ts/bin/protoc-gen-ts
which tells me that the binary is installed in a zip file (assuming I'm reading it right). How can I "expose" this binary like in classic yarn where it would be located in node_modules/.bin
?