由于今天nativesctipt无法正常工作,所以我对npm所做的几乎所有操作都会出现此错误
$ npm install -g nativescript
> nativescript@6.3.3 preuninstall /home/me/.local/lib/node_modules/nativescript
> node preuninstall.js
npm ERR! Unexpected end of JSON input while parsing near '...ob":"^7.0.0","istanbu'
npm ERR! A complete log of this run can be found in:
npm ERR! /home/me/.npm/_logs/2020-01-25T18_13_57_681Z-debug.log
Error while loading nativescript-starter-kits is: Command npm failed with exit code 1
/home/me/.local/bin/tns -> /home/me/.local/lib/node_modules/nativescript/bin/tns
/home/me/.local/bin/nativescript -> /home/me/.local/lib/node_modules/nativescript/bin/tns
> nativescript@6.3.3 postinstall /home/me/.local/lib/node_modules/nativescript
> node postinstall.js
npm ERR! Unexpected end of JSON input while parsing near '...ob":"^7.0.0","istanbu'
npm ERR! A complete log of this run can be found in:
npm ERR! /home/me/.npm/_logs/2020-01-25T18_14_05_772Z-debug.log
Error while loading nativescript-starter-kits is: Command npm failed with exit code 1
ENOENT: no such file or directory, open '/home/me/.local/share/.nativescript-cli/extensions/node_modules/nativescript-starter-kits/package.json'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/nativescript/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
+ nativescript@6.3.3
updated 1 package in 24.848s
答案 0 :(得分:2)
尝试以下步骤:
清除npm缓存
npm cache clean
安装软件包。
npm install -g nativescript
注意:如果仍然无法运行,请执行npm cache clean --force
,然后安装