在项目中安装 pbjs 后找不到 pbjs 命令

pbjs command not found after installing pbjs in project

我正在使用 protobuf 开发一个离子项目,我已经安装了 protobuf。 Bow 我想安装 pbjs 工具。我在项目目录中使用 npm install pbjs 这样做了。但是当我使用 pbjs 后跟有效参数时,我得到 -bash: command not found 'pbjs'

我做错了什么?

是因为你没有全局安装pbjs,你可以通过

全局安装

npm install -g pbjs
或者您甚至可以从项目目录访问它而无需通过执行全局安装 node_modules/.bin/pbjs <command you want to execute> 由于您已经将其安装在您的项目目录中。