通过npm init 生成 package.json的问题

我新建了个项目,用npm init 生成package.json报错如下

npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "Vue-Q&A": Tags may not have any characters that encodeURICompo
nent encodes.
About to write to Documents/Vue-Q&A/package.json:

{
  "name": "",
  "version": ""
}


Is this ok? (yes)
npm ERR! Callback called more than once.

npm ERR! A complete log of this run can be found in:
npm ERR!    /.npm/_logs/2017-12-18T01_17_15_433Z-debug.log

生成的package.json只有name和version?
请问这是什么情况?如何解决?

阅读 6.3k
1 个回答

无效的name,name会成为url的一部分,不能含有url非法字符。把&去掉看看,当encodeURIComponent() 函数把name作为 URI 组件进行编码时,出现了错误!因为encodeURIComponent不会对 ASCII 字母和数字进行编码,也不会对这些 ASCII 标点符号进行编码: - _ . ! ~ * ' ( ) 。其他字符(比如 :;/?:@&=+$,# 这些用于分隔 URI 组件的标点符号),都是由一个或多个十六进制的转义序列替换的。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题