简体   繁体   English

尝试安装 protobufjs 时出现 npm 错误代码 EINVALIDTAGNAME

[英]npm error code EINVALIDTAGNAME when trying to install protobufjs

I got an error when installing protobufjs with this command:使用以下命令安装 protobufjs 时出现错误:

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,您可以运行:

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 使用--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

Just simply use the following Syntax #nodejs #Express只需简单地使用以下语法#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因为默认情况下,较新版本的Nodejs具有--save方法

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希望它有效

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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