首页 > 解决方案 > React-native:无法安装 expo-cli

问题描述

我对 react-native 完全陌生

我正在尝试安装 expo-cli 以便我可以创建 react-native 应用程序但是当我运行时npm i -g expo-cli我得到了这个日志

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\ayman\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   '-g',
1 verbose cli   'expo-cli'
1 verbose cli ]
2 info using npm@6.14.8
3 info using node@v12.19.0
4 verbose npm-session babc0a9e465407d4
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 304 https://registry.npmjs.org/expo-cli 661ms (from cache)
8 silly pacote tag manifest for expo-cli@latest fetched in 733ms
9 timing stage:loadCurrentTree Completed in 773ms
10 silly install loadIdealTree
11 silly install cloneCurrentTreeToIdealTree
12 timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
13 silly install loadShrinkwrap
14 timing stage:loadIdealTree:loadShrinkwrap Completed in 4ms
15 silly install loadAllDepsIntoIdealTree
16 silly resolveWithNewModule expo-cli@3.28.0 checking installable status
17 http fetch GET 304 https://registry.npmjs.org/@expo%2fbunyan 229ms (from cache)
18 silly pacote version manifest for @expo/bunyan@3.0.2 fetched in 236ms
19 silly resolveWithNewModule @expo/bunyan@3.0.2 checking installable status
20 http fetch GET 304 https://registry.npmjs.org/@expo%2fxdl 178ms (from cache)
21 silly fetchPackageMetaData error for @expo/xdl@58.0.14 Unexpected end of JSON input while parsing near '..."glob-promise":"3.4.0'
22 http fetch GET 304 https://registry.npmjs.org/@expo%2fjson-file 609ms (from cache)
23 silly pacote version manifest for @expo/json-file@8.2.24 fetched in 632ms
24 silly resolveWithNewModule @expo/json-file@8.2.24 checking installable status
25 http fetch GET 304 https://registry.npmjs.org/@expo%2feas-build-job 644ms (from cache)
26 http fetch GET 304 https://registry.npmjs.org/@expo%2fpackage-manager 639ms (from cache)
27 silly fetchPackageMetaData error for @expo/package-manager@0.0.33 Unexpected end of JSON input while parsing near '...newline":"^3.1.0","fi'
28 http fetch GET 304 https://registry.npmjs.org/@expo%2fconfig 678ms (from cache)
29 http fetch GET 304 https://registry.npmjs.org/@expo%2fsimple-spinner 671ms (from cache)
30 http fetch GET 304 https://registry.npmjs.org/@expo%2fspawn-async 667ms (from cache)
31 http fetch GET 304 https://registry.npmjs.org/@expo%2fplist 679ms (from cache)
32 silly pacote range manifest for @expo/eas-build-job@^0.1.0 fetched in 691ms
33 silly resolveWithNewModule @expo/eas-build-job@0.1.1 checking installable status
34 http fetch GET 304 https://registry.npmjs.org/@expo%2fresults 681ms (from cache)
35 silly pacote version manifest for @expo/simple-spinner@1.0.2 fetched in 709ms
36 silly resolveWithNewModule @expo/simple-spinner@1.0.2 checking installable status
37 silly pacote version manifest for @expo/spawn-async@1.5.0 fetched in 707ms
38 silly resolveWithNewModule @expo/spawn-async@1.5.0 checking installable status
39 silly pacote version manifest for @expo/plist@0.0.10 fetched in 718ms
40 silly resolveWithNewModule @expo/plist@0.0.10 checking installable status
41 http fetch GET 304 https://registry.npmjs.org/@expo%2fdev-tools 754ms (from cache)
42 http fetch GET 304 https://registry.npmjs.org/@hapi%2fjoi 367ms (from cache)
43 silly pacote version manifest for @expo/dev-tools@0.13.53 fetched in 793ms
44 silly resolveWithNewModule @expo/dev-tools@0.13.53 checking installable status
45 http fetch GET 304 https://registry.npmjs.org/babel-runtime 180ms (from cache)
46 silly fetchPackageMetaData error for babel-runtime@6.26.0 Unexpected end of JSON input while parsing near '...el-regenerator-runtim'
47 http fetch GET 304 https://registry.npmjs.org/base32.js 198ms (from cache)
48 silly pacote version manifest for base32.js@0.1.0 fetched in 200ms
49 silly resolveWithNewModule base32.js@0.1.0 checking installable status
50 http fetch GET 304 https://registry.npmjs.org/boxen 190ms (from cache)
51 silly pacote version manifest for boxen@4.1.0 fetched in 193ms
52 silly resolveWithNewModule boxen@4.1.0 checking installable status
53 http fetch GET 200 https://registry.npmjs.org/@expo/results/-/results-1.0.0.tgz 249ms
54 http fetch GET 304 https://registry.npmjs.org/clipboardy 244ms (from cache)
55 http fetch GET 304 https://registry.npmjs.org/chalk 247ms (from cache)
56 http fetch GET 304 https://registry.npmjs.org/command-exists 193ms (from cache)
57 http fetch GET 304 https://registry.npmjs.org/cli-table3 252ms (from cache)
58 silly pacote version manifest for clipboardy@2.3.0 fetched in 253ms
59 silly resolveWithNewModule clipboardy@2.3.0 checking installable status
60 silly pacote range manifest for chalk@^4.0.0 fetched in 257ms
61 silly resolveWithNewModule chalk@4.1.0 checking installable status
62 silly pacote range manifest for command-exists@^1.2.8 fetched in 205ms
63 silly resolveWithNewModule command-exists@1.2.9 checking installable status
64 silly pacote range manifest for cli-table3@^0.6.0 fetched in 296ms
65 silly resolveWithNewModule cli-table3@0.6.0 checking installable status
66 silly pacote range manifest for @expo/results@^1.0.0 fetched in 1024ms
67 silly resolveWithNewModule @expo/results@1.0.0 checking installable status
68 http fetch GET 304 https://registry.npmjs.org/concat-stream 231ms (from cache)
69 http fetch GET 304 https://registry.npmjs.org/dateformat 206ms (from cache)
70 http fetch GET 304 https://registry.npmjs.org/commander 272ms (from cache)
71 silly pacote version manifest for concat-stream@1.6.2 fetched in 238ms
72 silly resolveWithNewModule concat-stream@1.6.2 checking installable status
73 silly pacote version manifest for dateformat@3.0.3 fetched in 219ms
74 silly resolveWithNewModule dateformat@3.0.3 checking installable status
75 silly pacote version manifest for commander@2.17.1 fetched in 287ms
76 silly resolveWithNewModule commander@2.17.1 checking installable status
77 http fetch GET 304 https://registry.npmjs.org/delay-async 499ms (from cache)
78 http fetch GET 304 https://registry.npmjs.org/glob 384ms (from cache)
79 http fetch GET 304 https://registry.npmjs.org/es6-error 470ms (from cache)
80 http fetch GET 304 https://registry.npmjs.org/env-editor 510ms (from cache)
81 http fetch GET 304 https://registry.npmjs.org/fs-extra 400ms (from cache)
82 http fetch GET 304 https://registry.npmjs.org/figures 483ms (from cache)
83 silly pacote version manifest for delay-async@1.2.0 fetched in 536ms
84 silly resolveWithNewModule delay-async@1.2.0 checking installable status
85 http fetch GET 304 https://registry.npmjs.org/getenv 419ms (from cache)
86 silly pacote version manifest for es6-error@3.2.0 fetched in 506ms
87 silly resolveWithNewModule es6-error@3.2.0 checking installable status
88 silly pacote version manifest for glob@7.1.6 fetched in 426ms
89 silly resolveWithNewModule glob@7.1.6 checking installable status
90 silly pacote range manifest for env-editor@^0.4.1 fetched in 550ms
91 silly resolveWithNewModule env-editor@0.4.1 checking installable status
92 silly pacote version manifest for fs-extra@9.0.0 fetched in 447ms
93 silly resolveWithNewModule fs-extra@9.0.0 checking installable status
94 silly pacote version manifest for figures@3.2.0 fetched in 516ms
95 silly resolveWithNewModule figures@3.2.0 checking installable status
96 silly pacote version manifest for getenv@0.7.0 fetched in 451ms
97 silly resolveWithNewModule getenv@0.7.0 checking installable status
98 http fetch GET 200 https://registry.npmjs.org/@hapi/joi/-/joi-17.1.1.tgz 821ms
99 silly pacote range manifest for @hapi/joi@^17.1.1 fetched in 1219ms
100 warn deprecated @hapi/joi@17.1.1: joi is leaving the @hapi organization and moving back to 'joi' (https://github.com/sideway/joi/issues/2411)
101 silly resolveWithNewModule @hapi/joi@17.1.1 checking installable status
102 http fetch GET 200 https://registry.npmjs.org/@expo/config/-/config-3.3.10.tgz 1039ms
103 http fetch GET 304 https://registry.npmjs.org/got 283ms (from cache)
104 silly pacote version manifest for @expo/config@3.3.10 fetched in 1848ms
105 silly resolveWithNewModule @expo/config@3.3.10 checking installable status
106 silly pacote range manifest for got@^11.1.4 fetched in 314ms
107 silly resolveWithNewModule got@11.7.0 checking installable status
108 http fetch GET 304 https://registry.npmjs.org/invariant 314ms (from cache)
109 silly pacote version manifest for invariant@2.2.4 fetched in 344ms
110 silly resolveWithNewModule invariant@2.2.4 checking installable status
111 http fetch GET 304 https://registry.npmjs.org/inquirer 348ms (from cache)
112 http fetch GET 304 https://registry.npmjs.org/indent-string 365ms (from cache)
113 http fetch GET 304 https://registry.npmjs.org/keychain 354ms (from cache)
114 http fetch GET 304 https://registry.npmjs.org/js-yaml 359ms (from cache)
115 http fetch GET 304 https://registry.npmjs.org/klaw-sync 350ms (from cache)
116 silly pacote version manifest for inquirer@5.2.0 fetched in 379ms
117 silly resolveWithNewModule inquirer@5.2.0 checking installable status
118 silly pacote version manifest for keychain@1.3.0 fetched in 382ms
119 silly resolveWithNewModule keychain@1.3.0 checking installable status
120 silly pacote version manifest for indent-string@4.0.0 fetched in 398ms
121 silly resolveWithNewModule indent-string@4.0.0 checking installable status
122 silly pacote range manifest for js-yaml@^3.13.1 fetched in 397ms
123 silly resolveWithNewModule js-yaml@3.14.0 checking installable status
124 silly pacote version manifest for klaw-sync@6.0.0 fetched in 400ms
125 silly resolveWithNewModule klaw-sync@6.0.0 checking installable status
126 http fetch GET 304 https://registry.npmjs.org/leven 330ms (from cache)
127 silly pacote range manifest for leven@^3.1.0 fetched in 379ms
128 silly resolveWithNewModule leven@3.1.0 checking installable status
129 http fetch GET 304 https://registry.npmjs.org/envinfo 1124ms (from cache)
130 http fetch GET 304 https://registry.npmjs.org/lodash 285ms (from cache)
131 http fetch GET 304 https://registry.npmjs.org/md5-file 279ms (from cache)
132 silly pacote version manifest for envinfo@7.5.0 fetched in 1136ms
133 silly resolveWithNewModule envinfo@7.5.0 checking installable status
134 silly pacote version manifest for lodash@4.17.15 fetched in 296ms
135 silly resolveWithNewModule lodash@4.17.15 checking installable status
136 silly pacote range manifest for md5-file@^5.0.0 fetched in 290ms
137 silly resolveWithNewModule md5-file@5.0.0 checking installable status
138 http fetch GET 304 https://registry.npmjs.org/npm-package-arg 252ms (from cache)
139 silly pacote version manifest for npm-package-arg@6.1.0 fetched in 256ms
140 silly resolveWithNewModule npm-package-arg@6.1.0 checking installable status
141 http fetch GET 304 https://registry.npmjs.org/ora 225ms (from cache)
142 silly pacote version manifest for ora@3.4.0 fetched in 226ms
143 silly resolveWithNewModule ora@3.4.0 checking installable status
144 http fetch GET 304 https://registry.npmjs.org/pngjs 321ms (from cache)
145 http fetch GET 304 https://registry.npmjs.org/prompts 310ms (from cache)
146 http fetch GET 304 https://registry.npmjs.org/progress 325ms (from cache)
147 http fetch GET 304 https://registry.npmjs.org/qrcode-terminal 270ms (from cache)
148 silly pacote version manifest for pngjs@3.4.0 fetched in 350ms
149 silly resolveWithNewModule pngjs@3.4.0 checking installable status
150 silly pacote range manifest for prompts@^2.3.2 fetched in 339ms
151 silly resolveWithNewModule prompts@2.3.2 checking installable status
152 silly pacote version manifest for progress@2.0.3 fetched in 363ms
153 silly resolveWithNewModule progress@2.0.3 checking installable status
154 http fetch GET 304 https://registry.npmjs.org/pacote 367ms (from cache)
155 silly pacote version manifest for qrcode-terminal@0.11.0 fetched in 327ms
156 silly resolveWithNewModule qrcode-terminal@0.11.0 checking installable status
157 silly pacote range manifest for pacote@^11.1.0 fetched in 411ms
158 silly resolveWithNewModule pacote@11.1.11 checking installable status
159 http fetch GET 304 https://registry.npmjs.org/react-dev-utils 298ms (from cache)
160 silly pacote range manifest for react-dev-utils@~10.2.1 fetched in 312ms
161 silly resolveWithNewModule react-dev-utils@10.2.1 checking installable status
162 http fetch GET 304 https://registry.npmjs.org/slash 308ms (from cache)
163 http fetch GET 304 https://registry.npmjs.org/strip-ansi 296ms (from cache)
164 http fetch GET 304 https://registry.npmjs.org/semver 319ms (from cache)
165 silly pacote version manifest for slash@1.0.0 fetched in 321ms
166 silly resolveWithNewModule slash@1.0.0 checking installable status
167 silly pacote range manifest for strip-ansi@^6.0.0 fetched in 311ms
168 silly resolveWithNewModule strip-ansi@6.0.0 checking installable status
169 http fetch GET 304 https://registry.npmjs.org/tar 307ms (from cache)
170 silly pacote version manifest for semver@5.5.0 fetched in 341ms
171 silly resolveWithNewModule semver@5.5.0 checking installable status
172 silly pacote range manifest for tar@^6.0.5 fetched in 323ms
173 silly resolveWithNewModule tar@6.0.5 checking installable status
174 http fetch GET 304 https://registry.npmjs.org/terminal-link 223ms (from cache)
175 http fetch GET 304 https://registry.npmjs.org/tempy 233ms (from cache)
176 silly pacote range manifest for terminal-link@^2.1.1 fetched in 242ms
177 silly resolveWithNewModule terminal-link@2.1.1 checking installable status
178 silly pacote range manifest for tempy@^0.3.0 fetched in 247ms
179 silly resolveWithNewModule tempy@0.3.0 checking installable status
180 http fetch GET 304 https://registry.npmjs.org/untildify 255ms (from cache)
181 silly pacote version manifest for untildify@3.0.3 fetched in 261ms
182 silly resolveWithNewModule untildify@3.0.3 checking installable status
183 http fetch GET 304 https://registry.npmjs.org/validator 240ms (from cache)
184 http fetch GET 304 https://registry.npmjs.org/uuid 267ms (from cache)
185 silly pacote version manifest for validator@10.5.0 fetched in 252ms
186 silly resolveWithNewModule validator@10.5.0 checking installable status
187 silly pacote range manifest for uuid@^8.0.0 fetched in 275ms
188 silly resolveWithNewModule uuid@8.3.1 checking installable status
189 http fetch GET 304 https://registry.npmjs.org/wordwrap 188ms (from cache)
190 silly pacote version manifest for wordwrap@1.0.0 fetched in 204ms
191 silly resolveWithNewModule wordwrap@1.0.0 checking installable status
192 http fetch GET 304 https://registry.npmjs.org/xcode 223ms (from cache)
193 silly pacote range manifest for xcode@^3.0.1 fetched in 233ms
194 silly resolveWithNewModule xcode@3.0.1 checking installable status
195 http fetch GET 304 https://registry.npmjs.org/@expo%2ftraveling-fastlane-darwin 231ms (from cache)
196 http fetch GET 304 https://registry.npmjs.org/@expo%2ftraveling-fastlane-linux 243ms (from cache)
197 silly fetchPackageMetaData error for @expo/traveling-fastlane-linux@1.15.1 sha512-YaFAYYOOxImYNx9s6X3tY6fC1y6rka0KXstrs2zrS+vHyyBD8IOhNtIUvybHScM3jUL+qukgKElAb+7gzlF6Eg== integrity checksum failed when using sha512: wanted sha512-YaFAYYOOxImYNx9s6X3tY6fC1y6rka0KXstrs2zrS+vHyyBD8IOhNtIUvybHScM3jUL+qukgKElAb+7gzlF6Eg== but got sha512-GQf0CjubEs7HZq6a2WCqnQarS+voiHM7e7xjzUP+STxshNwp0ZmrovWKWzKzwTw7gzmauPJVPIaQswuLH9CNFg==. (716032 bytes)
198 silly fetchPackageMetaData error for @expo/traveling-fastlane-darwin@1.15.1 sha512-7sjG83+o9BT4MVPNq2UVqy1Oyg3n47FpEIDxc0M9CQvbC1WgYsAKloOJ85g5GRXZAjqzPOPUZF+lBhGbOwmQvg== integrity checksum failed when using sha512: wanted sha512-7sjG83+o9BT4MVPNq2UVqy1Oyg3n47FpEIDxc0M9CQvbC1WgYsAKloOJ85g5GRXZAjqzPOPUZF+lBhGbOwmQvg== but got sha512-SM7EdpLAjsnz3jO1p9p6z3mu3M0z65m3ZlcYgksmx/vex7ZPwa3Jd/y7FakanAvL7TRo3qXiGvODGwHIEUWOJA==. (2869703 bytes)
199 timing stage:rollbackFailedOptional Completed in 11ms
200 timing stage:runTopLevelLifecycles Completed in 44186ms
201 warn optional SKIPPING OPTIONAL DEPENDENCY: @expo/traveling-fastlane-linux@1.15.1 (node_modules\expo-cli\node_modules\@expo\traveling-fastlane-linux):
202 warn optional SKIPPING OPTIONAL DEPENDENCY: sha512-YaFAYYOOxImYNx9s6X3tY6fC1y6rka0KXstrs2zrS+vHyyBD8IOhNtIUvybHScM3jUL+qukgKElAb+7gzlF6Eg== integrity checksum failed when using sha512: wanted sha512-YaFAYYOOxImYNx9s6X3tY6fC1y6rka0KXstrs2zrS+vHyyBD8IOhNtIUvybHScM3jUL+qukgKElAb+7gzlF6Eg== but got sha512-GQf0CjubEs7HZq6a2WCqnQarS+voiHM7e7xjzUP+STxshNwp0ZmrovWKWzKzwTw7gzmauPJVPIaQswuLH9CNFg==. (716032 bytes)
203 warn optional SKIPPING OPTIONAL DEPENDENCY: @expo/traveling-fastlane-darwin@1.15.1 (node_modules\expo-cli\node_modules\@expo\traveling-fastlane-darwin):
204 warn optional SKIPPING OPTIONAL DEPENDENCY: sha512-7sjG83+o9BT4MVPNq2UVqy1Oyg3n47FpEIDxc0M9CQvbC1WgYsAKloOJ85g5GRXZAjqzPOPUZF+lBhGbOwmQvg== integrity checksum failed when using sha512: wanted sha512-7sjG83+o9BT4MVPNq2UVqy1Oyg3n47FpEIDxc0M9CQvbC1WgYsAKloOJ85g5GRXZAjqzPOPUZF+lBhGbOwmQvg== but got sha512-SM7EdpLAjsnz3jO1p9p6z3mu3M0z65m3ZlcYgksmx/vex7ZPwa3Jd/y7FakanAvL7TRo3qXiGvODGwHIEUWOJA==. (2869703 bytes)
205 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '..."glob-promise":"3.4.0'
205 verbose stack     at JSON.parse (<anonymous>)
205 verbose stack     at parseJson (C:\Users\ayman\AppData\Roaming\npm\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
205 verbose stack     at C:\Users\ayman\AppData\Roaming\npm\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50
205 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:97:5)
206 verbose cwd C:\Users\ayman\Downloads\Projects\react-native
207 verbose Windows_NT 10.0.18362
208 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\ayman\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "expo-cli"
209 verbose node v12.19.0
210 verbose npm  v6.14.8
211 error Unexpected end of JSON input while parsing near '..."glob-promise":"3.4.0'
212 verbose exit [ 1, true ]

我尝试过使用npm cache clean --force和 我尝试过清理缓存npm cache verify,但这并没有什么区别。它只是一直失败,我得到了这些日志。有人知道为什么会这样吗?

标签: node.jsreact-nativenpm

解决方案


You need to open your CMD in "run as administrator" and then execute npm cache clean --force


推荐阅读