我试图运行以下脚本:https://github.com/drenther/bdnd_example,但随后出现此错误:npm ERR!无效的名称:“排队英雄”
我尝试过多次重新安装所有内容。
错误日志:
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\Devx8\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build' ]
2 info using npm@6.9.0
3 info using node@v10.16.0
4 verbose stack Error: Invalid name: "Line up the heroes"
4 verbose stack at ensureValidName (C:\Users\Devx8\AppData\Roaming\npm\node_modules\npm\node_modules\normalize-package-data\lib\fixer.js:336:15)
4 verbose stack at Object.fixNameField (C:\Users\Devx8\AppData\Roaming\npm\node_modules\npm\node_modules\normalize-package-data\lib\fixer.js:215:5)
4 verbose stack at C:\Users\Devx8\AppData\Roaming\npm\node_modules\npm\node_modules\normalize-package-data\lib\normalize.js:32:38
4 verbose stack at Array.forEach (<anonymous>)
4 verbose stack at normalize (C:\Users\Devx8\AppData\Roaming\npm\node_modules\npm\node_modules\normalize-package-data\lib\normalize.js:31:15)
4 verbose stack at final (C:\Users\Devx8\AppData\Roaming\npm\node_modules\npm\node_modules\read-package-json\read-json.js:411:5)
4 verbose stack at then (C:\Users\Devx8\AppData\Roaming\npm\node_modules\npm\node_modules\read-package-json\read-json.js:160:5)
4 verbose stack at C:\Users\Devx8\AppData\Roaming\npm\node_modules\npm\node_modules\read-package-json\read-json.js:280:12
4 verbose stack at C:\Users\Devx8\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:90:16
4 verbose stack at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)
5 verbose cwd C:\xampp2\htdocs\todonew
6 verbose Windows_NT 10.0.17134
7 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Devx8\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
8 verbose node v10.16.0
9 verbose npm v6.9.0
10 error Invalid name: "Line up the heroes"
11 verbose exit [ 1, true ]
答案 0 :(得分:1)
npm软件包名称不得包含空格或大写字母,将name
文件中的package.json
更改为lineuptheheroes
之类的文字(仅用于测试),然后重试,还请查看文档here了解如何输入有效名称。