node.jsprotocol-buffersbackendprotobuf.js

pbjs command not found after installing pbjs in project


I am working on an ionic project using protobuf and I already installed protobuf. Bow i want to install the pbjs tool. I did so in the project directory using npm install pbjs. But when i use pbjs followed by valid arguments, I am given -bash: command not found 'pbjs'

What am I doing wrong?


Solution

  • Its because you haven't installed pbjs globally, You can install it globally with

    npm install -g pbjs
    Or you could even access it from the project directory without installing it globally by doing node_modules/.bin/pbjs <command you want to execute> Since you have already installed it in your project dir.