【发布时间】:2019-03-17 00:30:49
【问题描述】:
我正在尝试使用以下命令安装 hooper fpr 一个 vue.js 示例:
$ npm install hooper
并显示下一个错误
npm ERR! file /home/juanlh/package.json
npm ERR! code EJSONPARSE
npm ERR! JSON.parse Failed to parse json
npm ERR! JSON.parse Unexpected end of JSON input while parsing near ''
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/juanlh/.npm/_logs/2019-03-16T14_39_47_947Z-debug.log
日志:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/local/bin/npm', 'install', 'hooper' ]
2 info using npm@6.9.0
3 info using node@v8.10.0
4 verbose config Skipping project config: /home/juanlh/.npmrc. (matches userconfig)
5 verbose npm-session e3d2c58aee19e2f6
6 silly install loadCurrentTree
7 silly install readLocalPackageData
8 timing stage:rollbackFailedOptional Completed in 6ms
9 timing stage:runTopLevelLifecycles Completed in 124ms
10 verbose stack Error: Failed to parse json
10 verbose stack Unexpected end of JSON input while parsing near ''
10 verbose stack at parseError (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:452:11)
10 verbose stack at parseJson (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:104:26)
10 verbose stack at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:51:5
10 verbose stack at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:90:16
10 verbose stack at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)
11 verbose cwd /home/juanlh
12 verbose Linux 4.18.0-16-generic
13 verbose argv "/usr/bin/node" "/usr/local/bin/npm" "install" "hooper"
14 verbose node v8.10.0
15 verbose npm v6.9.0
16 error file /home/juanlh/package.json
17 error code EJSONPARSE
18 error JSON.parse Failed to parse json
18 error JSON.parse Unexpected end of JSON input while parsing near ''
19 error JSON.parse Failed to parse package.json data.
19 error JSON.parse package.json must be actual JSON, not just JavaScript.
20 verbose exit [ 1, true ]
package.json 没有创建,是我自己创建的,是空的。
【问题讨论】:
标签: json npm ubuntu-18.04