在安装nodemon时,在ansi-regex签名的npm安装中得到错误信息。

问题描述 投票:0回答:1

我试过了 sudo npm -g install nodemon 但得到这个错误。

npm ERR! Unexpected end of JSON input while parsing near '...q5EQXJ93KwEBWj7gSmuYa'

该错误的日志是:

184 silly resolveWithNewModule [email protected] checking installable status
185 http fetch GET 304 https://registry.npmjs.org/ansi-regex 34ms (from cache)
186 silly fetchPackageMetaData error for ansi-regex@^4.1.0 Unexpected end of JSON input while parsing near '...q5EQXJ93KwEBWj7gSmuYa'
187 timing stage:rollbackFailedOptional Completed in 0ms
188 timing stage:runTopLevelLifecycles Completed in 1719ms
189 warn optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/nodemon/node_modules/chokidar/node_modules/fsevents):
190 warn notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
191 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS:    darwin
191 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch:  any
191 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS:   linux
191 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
192 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...q5EQXJ93KwEBWj7gSmuYa'
192 verbose stack     at JSON.parse (<anonymous>)
192 verbose stack     at parseJson (/usr/lib/node_modules/npm/node_modules/json-parse-better-errors/index.js:7:17)
192 verbose stack     at /usr/lib/node_modules/npm/node_modules/node-fetch-npm/src/body.js:96:50
192 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:97:5)
193 verbose cwd /home/andre/Documents/2020/Web Development/EJS Challenge Starting Files/EJS Challenge Starting Files/ejs-challenge
194 verbose Linux 5.4.0-7626-generic
195 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "nodemon"
196 verbose node v12.16.3
197 verbose npm  v6.14.5
198 error Unexpected end of JSON input while parsing near '...q5EQXJ93KwEBWj7gSmuYa'
199 verbose exit [ 1, true ]

我已经尝试 npm cache clean --force 和改变注册表,但它没有工作。

node.js json npm nodemon
1个回答
0
投票

npm cache clean --force 不足以清理 ansi-regex 缓存,所以......。sudo npm cache clean --force 做到了这一点。

© www.soinside.com 2019 - 2024. All rights reserved.