Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--ts_proto_out: protoc-gen-ts_proto: The system cannot find the file specified. #93

Closed
dmitrijs-pavlovs-dev opened this issue Jun 17, 2020 · 9 comments

Comments

@dmitrijs-pavlovs-dev
Copy link

dmitrijs-pavlovs-dev commented Jun 17, 2020

Hello i am having troubles running my script on windows.
This is the script:

SRC_DIR="./libs/proto-schema/src/proto/*.proto"
DEST_DIR="./libs/proto-schema/src/"

# node_modules/ts-proto/protoc-gen-ts_proto.cmd
protoc --plugin=protoc-gen-ts_proto=.\node_modules\.bin\protoc-gen-ts_proto.cmd --ts_proto_opt=outputEncodeMethods=true,useEnumNames=false,asClass=false,outputJsonMethods=true,context=true,outputNestJs=true,outputClientImpl=false --ts_proto_out=${DEST_DIR} ${SRC_DIR}

Relevant issues:
improbable-eng/ts-protoc-gen#15
#13

I tried changing the path to --plugin=protoc-gen-ts_proto=.\node_modules.bin\protoc-gen-ts_proto.cmd and also with %CD%

@stephenh
Copy link
Owner

Does $DEST_DIR work on windows? It looks like you might be mixing unix script conventions (SRC_DIR=...) and windows conventions (.cmd).

Other than that, I don't think I can help much.

If you figure it out and find something that we should specifically highlight in our readme to help future windows users, let me know.

@PhilipMantrov
Copy link
Contributor

protoc --plugin=protoc-gen-ts_proto=%CD%/node_modules/.bin/protoc-gen-ts_proto.cmd --ts_proto_opt=outputClientImpl=grpc-web --ts_proto_out=#{dir} #{dir}\#{base} -I #{dir} #{base}

%CD% -- resolve this issue
@stephenh add this in readme pls, its will help all windows users

@stephenh
Copy link
Owner

stephenh commented Sep 9, 2020

@PhilipMantrov what is the #{dir} syntax? Is that windows shell? powershell?

@PhilipMantrov
Copy link
Contributor

PhilipMantrov commented Sep 9, 2020

@PhilipMantrov what is the #{dir} syntax? Is that windows shell? powershell?

foreach -g \"src/definitions/proto/*f.proto\" -x \"protoc --plugin=protoc-gen-ts_proto=%CD%/node_modules/.bin/protoc-gen-ts_proto.cmd --ts_proto_opt=outputClientImpl=grpc-web --ts_proto_out=./src/definitions/generated #{dir}\\#{base} -I #{dir} #{base}\"

@stephenh is foreach-cli package (https://www.npmjs.com/package/foreach-cli), i use this for listed all files in dir

@Icyfirefists
Copy link

Hi, please don't let this close. No matter what I do on windows the error at the top of the page is all that is printed. It seems to only happen with typescript plugins.

Please help.

@tofluid
Copy link

tofluid commented Nov 11, 2021

Found out how to get this to work
Originally i was running the command as it was specified on the main page:

protoc -I ./proto --plugin=protoc-gen-ts_proto=.\node_modules\.bin\protoc-gen-ts_proto.cmd --ts_proto_out=./proto ./proto/test.proto

I finally got it to work on Windows by adding an extra \ when specifying the .cmd

protoc -I ./proto --plugin=protoc-gen-ts_proto=.\\node_modules\\.bin\\protoc-gen-ts_proto.cmd --ts_proto_out=./proto ./proto/test.proto

@bryding-su
Copy link

Found out how to get this to work Originally i was running the command as it was specified on the main page:

protoc -I ./proto --plugin=protoc-gen-ts_proto=.\node_modules\.bin\protoc-gen-ts_proto.cmd --ts_proto_out=./proto ./proto/test.proto

I finally got it to work on Windows by adding an extra \ when specifying the .cmd

protoc -I ./proto --plugin=protoc-gen-ts_proto=.\\node_modules\\.bin\\protoc-gen-ts_proto.cmd --ts_proto_out=./proto ./proto/test.proto

After many different attempts, this is the only thing that worked for me as well. I had to get rid of the -I arg though.

@stephenh
Copy link
Owner

@bryding-su / @tofluid thanks for reporting what worked for you; I've linked to this issue from the home page so hopefully it's easier for Windows users to find what works for them.

@wdaz
Copy link

wdaz commented Feb 9, 2024

@tofluid thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants