admin管理员组

文章数量:1279245

I got an error when installing protobufjs with this mand:

npm install protobufjs [--save --save-prefix=~]

the error is:

npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "[--save": Tags may not have any characters that encodeURIComponent encodes.

How can I fix this issue?

I got an error when installing protobufjs with this mand:

npm install protobufjs [--save --save-prefix=~]

the error is:

npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "[--save": Tags may not have any characters that encodeURIComponent encodes.

How can I fix this issue?

Share Improve this question edited Nov 27, 2018 at 7:31 Wodin 3,5382 gold badges28 silver badges58 bronze badges asked Nov 27, 2018 at 4:40 Fx Bayu Yunianto PabisaFx Bayu Yunianto Pabisa 671 gold badge2 silver badges4 bronze badges 2
  • The problem has to do with npm and not protobuf, so I removed the protobuf tag. I fixed the formatting of the mand and the error and also added some more context to the error. – Wodin Commented Nov 27, 2018 at 7:31
  • try npm install protobufjs --save – Sahith Vibudhi Commented Nov 27, 2018 at 8:11
Add a ment  | 

3 Answers 3

Reset to default 4

Where did you find that syntax?

Square brackets in the instructions for how to run something generally mean that the part in square brackets is optional. i.e. that you can run the mand with or without the part in square brackets.

For npm you can run:

npm install protobufjs

or

npm install protobufjs --save-prod

or

npm install protobufjs --save-dev

etc., depending on what you're trying to do.

I believe older versions of npm used --save instead of --save-prod and in later versions of npm, --save-prod is the default.

$ npm --version
6.4.1
$ npm install protobufjs
npm notice created a lockfile as package-lock.json. You should mit this file.

+ [email protected]
added 14 packages from 35 contributors and audited 16 packages in 4.502s
found 0 vulnerabilities

Just simply use the following Syntax #nodejs #Express

 npm install protobufjs

Insted of :

 npm install protobufjs --save-prod

or

 npm install protobufjs --save

Because the newer version of Nodejs by default having --save method

As best answer says:

prefix=~]

that's the problm

in my case was just a + for this line:

npm install --save request request-promise cheerio puppeteer+

copy-pasting from website, make me do this mistake

hope it works

本文标签: javascriptnpm error code EINVALIDTAGNAME when trying to install protobufjsStack Overflow