didi / mpx

Mpx,一款具有优秀开发体验和深度性能优化的增强型跨端小程序框架
https://mpxjs.cn
Apache License 2.0
3.59k stars 376 forks source link

安装@mpxjs/cli失败 #111

Closed zlab closed 5 years ago

zlab commented 5 years ago

MacBook:~ zhanqi$ npm i -g @mpxjs/cli npm ERR! Unexpected end of JSON input while parsing near '..."^1.0.0","xo":"*"},"d'

npm ERR! A complete log of this run can be found in: npm ERR! /Users/zhanqi/.npm/_logs/2019-04-17T03_06_58_812Z-debug.log

zlab commented 5 years ago
120 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '..."^1.0.0","xo":"*"},"d'
120 verbose stack     at JSON.parse (<anonymous>)
120 verbose stack     at parseJson (/usr/local/lib/node_modules/npm/node_modules/json-parse-better-errors/index.js:7:17)
120 verbose stack     at consumeBody.call.then.buffer (/usr/local/lib/node_modules/npm/node_modules/node-fetch-npm/src/body.js:96:50)
120 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:86:5)
121 verbose cwd /Users/zhanqi
122 verbose Darwin 17.7.0
123 verbose argv "/usr/local/Cellar/node/11.14.0/bin/node" "/usr/local/lib/node_modules/npm/bin/npm-cli.js" "install" "@mpxjs/cli@latest" "--global" "--prefix" "/Users/zhanqi/.npm/_npx/11080" "--loglevel" "error" "--json"
124 verbose node v11.14.0
125 verbose npm  v6.9.0
126 error Unexpected end of JSON input while parsing near '..."^1.0.0","xo":"*"},"d'
127 verbose exit [ 1, true ]
sky-admin commented 5 years ago

同Mac,升级到同版本,无法复现,你那边多次尝试都不行吗?方便把完整的log发出来吗?

zlab commented 5 years ago
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/11.14.0/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'i',
1 verbose cli   '-g',
1 verbose cli   '@mpxjs/cli' ]
2 info using npm@6.9.0
3 info using node@v11.14.0
4 verbose npm-session 47073c8c3a0022c5
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 200 https://registry.npmjs.org/@mpxjs%2fcli 19ms (from cache)
8 silly pacote tag manifest for @mpxjs/cli@latest fetched in 32ms
9 timing stage:loadCurrentTree Completed in 53ms
10 silly install loadIdealTree
11 silly install cloneCurrentTreeToIdealTree
12 timing stage:loadIdealTree:cloneCurrentTree Completed in 1ms
13 silly install loadShrinkwrap
14 timing stage:loadIdealTree:loadShrinkwrap Completed in 2ms
15 silly install loadAllDepsIntoIdealTree
16 silly resolveWithNewModule @mpxjs/cli@1.1.0 checking installable status
17 http fetch GET 200 https://registry.npmjs.org/download-git-repo 36ms (from cache)
18 http fetch GET 200 https://registry.npmjs.org/multimatch 32ms (from cache)
19 http fetch GET 200 https://registry.npmjs.org/minimatch 34ms (from cache)
20 http fetch GET 200 https://registry.npmjs.org/chalk 44ms (from cache)
21 http fetch GET 200 https://registry.npmjs.org/ora 35ms (from cache)
22 silly pacote range manifest for download-git-repo@^1.0.1 fetched in 43ms
23 silly resolveWithNewModule download-git-repo@1.1.0 checking installable status
24 http fetch GET 200 https://registry.npmjs.org/metalsmith 44ms (from cache)
25 http fetch GET 200 https://registry.npmjs.org/commander 49ms (from cache)
26 silly pacote range manifest for multimatch@^2.1.0 fetched in 43ms
27 silly resolveWithNewModule multimatch@2.1.0 checking installable status
28 http fetch GET 200 https://registry.npmjs.org/nunjucks 45ms (from cache)
29 http fetch GET 200 https://registry.npmjs.org/async 57ms (from cache)
30 silly pacote range manifest for minimatch@^3.0.0 fetched in 50ms
31 silly resolveWithNewModule minimatch@3.0.4 checking installable status
32 silly pacote range manifest for chalk@^2.1.0 fetched in 61ms
33 silly resolveWithNewModule chalk@2.4.2 checking installable status
34 silly pacote range manifest for ora@^1.3.0 fetched in 54ms
35 silly resolveWithNewModule ora@1.4.0 checking installable status
36 silly pacote range manifest for metalsmith@^2.1.0 fetched in 61ms
37 silly resolveWithNewModule metalsmith@2.3.0 checking installable status
38 silly pacote range manifest for commander@^2.9.0 fetched in 66ms
39 silly resolveWithNewModule commander@2.20.0 checking installable status
40 http fetch GET 200 https://registry.npmjs.org/inquirer 67ms (from cache)
41 silly pacote range manifest for async@^2.4.0 fetched in 75ms
42 silly resolveWithNewModule async@2.6.2 checking installable status
43 silly pacote range manifest for nunjucks@^3.1.2 fetched in 66ms
44 silly resolveWithNewModule nunjucks@3.2.0 checking installable status
45 http fetch GET 200 https://registry.npmjs.org/read-metadata 32ms (from cache)
46 silly pacote range manifest for inquirer@^6.0.0 fetched in 79ms
47 silly resolveWithNewModule inquirer@6.3.1 checking installable status
48 http fetch GET 200 https://registry.npmjs.org/rimraf 30ms (from cache)
49 http fetch GET 200 https://registry.npmjs.org/tildify 26ms (from cache)
50 silly pacote range manifest for read-metadata@^1.0.0 fetched in 43ms
51 silly resolveWithNewModule read-metadata@1.0.0 checking installable status
52 http fetch GET 200 https://registry.npmjs.org/user-home 23ms (from cache)
53 http fetch GET 200 https://registry.npmjs.org/semver 30ms (from cache)
54 http fetch GET 200 https://registry.npmjs.org/validate-npm-package-name 17ms (from cache)
55 silly pacote range manifest for rimraf@^2.5.0 fetched in 37ms
56 silly resolveWithNewModule rimraf@2.6.3 checking installable status
57 http fetch GET 200 https://registry.npmjs.org/update-notifier 27ms (from cache)
58 silly pacote range manifest for tildify@^1.2.0 fetched in 33ms
59 silly resolveWithNewModule tildify@1.2.0 checking installable status
60 silly pacote range manifest for user-home@^2.0.0 fetched in 29ms
61 silly resolveWithNewModule user-home@2.0.0 checking installable status
62 silly pacote range manifest for semver@^5.1.0 fetched in 36ms
63 silly resolveWithNewModule semver@5.7.0 checking installable status
64 silly pacote range manifest for validate-npm-package-name@^3.0.0 fetched in 22ms
65 silly resolveWithNewModule validate-npm-package-name@3.0.0 checking installable status
66 http fetch GET 200 https://registry.npmjs.org/request 47ms (from cache)
67 silly pacote range manifest for update-notifier@^2.5.0 fetched in 33ms
68 silly resolveWithNewModule update-notifier@2.5.0 checking installable status
69 silly pacote range manifest for request@^2.67.0 fetched in 51ms
70 silly resolveWithNewModule request@2.88.0 checking installable status
71 http fetch GET 200 https://registry.npmjs.org/lodash 4ms (from cache)
72 silly pacote range manifest for lodash@^4.17.11 fetched in 9ms
73 silly resolveWithNewModule lodash@4.17.11 checking installable status
74 http fetch GET 200 https://registry.npmjs.org/ansi-styles 8ms (from cache)
75 http fetch GET 200 https://registry.npmjs.org/escape-string-regexp 8ms (from cache)
76 http fetch GET 200 https://registry.npmjs.org/supports-color 10ms (from cache)
77 silly pacote range manifest for ansi-styles@^3.2.1 fetched in 11ms
78 silly resolveWithNewModule ansi-styles@3.2.1 checking installable status
79 silly pacote range manifest for escape-string-regexp@^1.0.5 fetched in 12ms
80 silly resolveWithNewModule escape-string-regexp@1.0.5 checking installable status
81 silly pacote range manifest for supports-color@^5.3.0 fetched in 13ms
82 silly resolveWithNewModule supports-color@5.5.0 checking installable status
83 http fetch GET 200 https://registry.npmjs.org/color-convert 4ms (from cache)
84 silly pacote range manifest for color-convert@^1.9.0 fetched in 6ms
85 silly resolveWithNewModule color-convert@1.9.3 checking installable status
86 http fetch GET 200 https://registry.npmjs.org/color-name 4ms (from cache)
87 silly pacote version manifest for color-name@1.1.3 fetched in 6ms
88 silly resolveWithNewModule color-name@1.1.3 checking installable status
89 http fetch GET 200 https://registry.npmjs.org/has-flag 3ms (from cache)
90 silly pacote range manifest for has-flag@^3.0.0 fetched in 4ms
91 silly resolveWithNewModule has-flag@3.0.0 checking installable status
92 http fetch GET 200 https://registry.npmjs.org/git-clone 3ms (from cache)
93 silly pacote range manifest for git-clone@^0.1.0 fetched in 4ms
94 silly resolveWithNewModule git-clone@0.1.0 checking installable status
95 http fetch GET 200 https://registry.npmjs.org/download 5ms (from cache)
96 silly pacote range manifest for download@^5.0.3 fetched in 7ms
97 silly resolveWithNewModule download@5.0.3 checking installable status
98 http fetch GET 200 https://registry.npmjs.org/caw 11ms (from cache)
99 http fetch GET 200 https://registry.npmjs.org/filenamify 10ms (from cache)
100 http fetch GET 200 https://registry.npmjs.org/decompress 12ms (from cache)
101 http fetch GET 200 https://registry.npmjs.org/mkdirp 13ms (from cache)
102 http fetch GET 200 https://registry.npmjs.org/pify 14ms (from cache)
103 http fetch GET 200 https://registry.npmjs.org/get-stream 15ms (from cache)
104 silly fetchPackageMetaData error for pify@^2.3.0 Unexpected end of JSON input while parsing near '..."^1.0.0","xo":"*"},"d'
105 silly pacote range manifest for caw@^2.0.0 fetched in 19ms
106 silly resolveWithNewModule caw@2.0.1 checking installable status
107 silly pacote range manifest for filenamify@^2.0.0 fetched in 18ms
108 silly resolveWithNewModule filenamify@2.1.0 checking installable status
109 silly pacote range manifest for decompress@^4.0.0 fetched in 20ms
110 silly resolveWithNewModule decompress@4.2.0 checking installable status
111 silly pacote range manifest for mkdirp@^0.5.1 fetched in 20ms
112 silly resolveWithNewModule mkdirp@0.5.1 checking installable status
113 silly pacote range manifest for get-stream@^3.0.0 fetched in 22ms
114 silly resolveWithNewModule get-stream@3.0.0 checking installable status
115 http fetch GET 200 https://registry.npmjs.org/got 22ms (from cache)
116 silly pacote range manifest for got@^6.3.0 fetched in 26ms
117 silly resolveWithNewModule got@6.7.1 checking installable status
118 timing stage:rollbackFailedOptional Completed in 1ms
119 timing stage:runTopLevelLifecycles Completed in 261ms
120 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '..."^1.0.0","xo":"*"},"d'
120 verbose stack     at JSON.parse (<anonymous>)
120 verbose stack     at parseJson (/usr/local/lib/node_modules/npm/node_modules/json-parse-better-errors/index.js:7:17)
120 verbose stack     at consumeBody.call.then.buffer (/usr/local/lib/node_modules/npm/node_modules/node-fetch-npm/src/body.js:96:50)
120 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:86:5)
121 verbose cwd /Users/zhanqi
122 verbose Darwin 17.7.0
123 verbose argv "/usr/local/Cellar/node/11.14.0/bin/node" "/usr/local/bin/npm" "i" "-g" "@mpxjs/cli"
124 verbose node v11.14.0
125 verbose npm  v6.9.0
126 error Unexpected end of JSON input while parsing near '..."^1.0.0","xo":"*"},"d'
127 verbose exit [ 1, true ]
zlab commented 5 years ago

我已经用yarn gloabl安装好了

sky-admin commented 5 years ago

看起来像是访问 https://registry.npmjs.org/pify 时候取到的json有误,而且是从缓存中取的。如果可以复现,可以试试清除npm缓存 (npm cache clean --force) 再安装,不想追究也没关系,yarn安装上就行。如果没什么别的问题这个issue就关闭咯。