question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to compile. 'proto' is not defined (also 'COMPILED')

See original GitHub issue

I’m using create-react-app with typescript and grpc-web, grpc & proto generated with command:

$(protoc) -I $(proto_dir) $(proto_dir)/ride.proto --js_out=import_style=commonjs:./rider/typescript/src/proto --grpc-web_out=import_style=commonjs+dts,mode=grpcwebtext:./rider/typescript/src/proto

App is not able to start, it throws tons of errors of form

Failed to compile.

./src/proto/ride_pb.js
  Line 37:     'proto' is not defined     no-undef
  Line 40:    'proto' is not defined     no-undef
  Line 41:    'COMPILED' is not defined  no-undef
  Line 42:     'proto' is not defined     no-undef
 ...

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:30
  • Comments:20

github_iconTop GitHub Comments

24reactions
alpakacommented, Dec 23, 2019

Maybe a better workaround is to ignore _pb.js files for eslint, which doesn’t require modifying the generated files every time (that gets old really fast).

Create a file called .env in your project root containing only EXTEND_ESLINT=true, then modify package.json to add ignorePatterns:

"eslintConfig": {
    "extends": "react-app",
    "ignorePatterns": ["**/*_pb.js"]
  }

Note that this is currently flagged experimental in the docs. Sources: https://create-react-app.dev/docs/setting-up-your-editor/ https://create-react-app.dev/docs/adding-custom-environment-variables/

9reactions
robcecilcommented, May 14, 2019

Btw, I get the same compile errors and I am not using Typescript.

If I simply edit the generated files by adding the /* eslint-disable */ at the top just like @argoyb . Be nice if there was some code gen flag to emit this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to encode .proto file into binary using protoc compiler ...
I was not able to find any documentation on the type definitions used alongside --encode=.
Read more >
How to avoid compiling protobuf compiler and use ...
The problem is that when the project compiles first time it also compiles a protobuf ... FAILED: Build did NOT complete successfully (0...
Read more >
Python Generated Code | Protocol Buffers - Google Developers
The Python code generated by the protocol buffer compiler is completely unaffected by the package name defined in the .proto file. Instead, Python...
Read more >
Protocol Buffers/gRPC Codegen Integration Into .NET Build
Also make sure not to include any file names to the Protobuf item collection, otherwise they will be compiled by default. If, by...
Read more >
List of the armcc error and warning messages - Arm Developer
Compiling this with armcc -c foo.c defines TEST to be 0 (the default). ... A similar error is also raised if there is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found