使用以下命令安装protobufjs时出现错误:
npm install protobufjs [--save --save-prefix=~]
错误是:
npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "[--save": Tags may not have any characters that encodeURIComponent encodes.
如何解决此问题?
最佳答案
您在哪里找到该语法?
说明书中有关如何运行某些内容的方括号通常表示方括号中的零件是可选的。即您可以在带或不带方括号的部分中运行命令。
对于npm,您可以运行:
npm install protobufjs
要么
npm install protobufjs --save-prod
要么
npm install protobufjs --save-dev
等等,具体取决于您要执行的操作。
我相信npm的旧版本使用
--save
而不是--save-prod
,在npm的更高版本中,--save-prod
是默认设置。$ npm --version
6.4.1
$ npm install protobufjs
npm notice created a lockfile as package-lock.json. You should commit this file.
+ protobufjs@6.8.8
added 14 packages from 35 contributors and audited 16 packages in 4.502s
found 0 vulnerabilities