简体   繁体   中英

npm error code EINVALIDTAGNAME when trying to install protobufjs

I got an error when installing protobufjs with this command:

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?

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. ie that you can run the command 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 commit this file.

+ protobufjs@6.8.8
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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM