improbable-eng / ts-protoc-gen

Protocol Buffers Compiler (protoc) plugin for TypeScript and gRPC-Web.
Apache License 2.0
1.36k stars 173 forks source link

"npm --prefix ./path install ./path" installs binary files under ./path rather than ./path/node_modules/.bin #270

Open zzwx opened 3 years ago

zzwx commented 3 years ago

Versions of relevant software used 0.14.0

What happened I'm trying to automate stuff from another directory.

What you expected to happen protoc-gen-ts protoc-gen-ts.cmd protoc-gen-ts.ps1

should appear under node_modules/.bin instead of project directory.

How to reproduce it (as minimally and precisely as possible):

npm --prefix ./path install ./path without node_modules

Also repeated attempts to do the same lead to

npm ERR! code EEXIST
npm ERR! path "PATH"\node_modules\ts-protoc-gen\bin\protoc-gen-ts
npm ERR! dest "PATH"\protoc-gen-ts.cmd
npm ERR! EEXIST: file already exists, cmd shim '"PATH"\node_modules\ts-protoc-gen\bin\protoc-gen-ts' -> "PATH_TWO_LEVELS_UP"
\grpc\grpcwebclient\protoc-gen-ts.cmd'
npm ERR! File exists: PATH\protoc-gen-ts.cmd
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

(Where PATH and PATH_TWO_LEVELS_UP are project-dependent with PATH_TWO_LEVELS_UP being 2 levels up from PATH)

Environment:

zzwx commented 3 years ago

yarn --cwd ./path works as intended. So it might be an npm bug.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.