使用npm安装Typescript时出错

时间:2018-07-09 19:05:48

标签: node.js typescript npm npm-install

当我尝试使用npm安装Typescript时,出现错误:

npm ERR! Unexpected end of JSON input while parsing near '...latest","mocha":"late'

这是日志文件的内容:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'i',
1 verbose cli   'typescript',
1 verbose cli   '--save-dev' ]
2 info using npm@6.0.1
3 info using node@v10.0.0
4 verbose npm-session d4b7b23a6f27323f
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 200 https://registry.npmjs.org/typescript 28ms (from cache)
8 silly fetchPackageMetaData error for typescript@latest Unexpected end of JSON input while parsing near '...latest","mocha":"late'
9 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...latest","mocha":"late'
9 verbose stack     at JSON.parse (<anonymous>)
9 verbose stack     at parseJson (/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/json-parse-better-errors/index.js:7:17)
9 verbose stack     at consumeBody.call.then.buffer (/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/src/body.js:96:50)
9 verbose stack     at process._tickCallback (internal/process/next_tick.js:178:7)
10 verbose cwd /Users/Bayo/Documents/Personal/Learning/tstest
11 verbose Darwin 16.7.0
12 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "i" "typescript" "--save-dev"
13 verbose node v10.0.0
14 verbose npm  v6.0.1
15 error Unexpected end of JSON input while parsing near '...latest","mocha":"late'
16 verbose exit [ 1, true ]

我当前的npm版本是6.0.1 我当前的节点版本是10.0.0

0 个答案:

没有答案