在Linuxmint 20.1上安装无服务器时出错

时间:2020-09-17 07:30:26

标签: amazon-web-services npm serverless

我想将无服务器安装为全局服务器。 npm install -g serverless

但是在安装过程中,我遇到了类似的错误

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/serverless/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! Unexpected end of JSON input while parsing near '...","querystring":"^0.2'

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/fathisiddiqi/.npm/_logs/2020-09-17T07_24_40_981Z-debug.log

我的npm cache clean --force拥有干净的npm缓存 我再次尝试,并遇到另一个类似的错误

npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/lodash (over 30000ms)

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/fathisiddiqi/.npm/_logs/2020-09-17T07_26_46_746Z-debug.log

最后,我尝试再次安装无服务器。但仍然收到消息

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

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/fathisiddiqi/.npm/_logs/2020-09-17T07_30_56_320Z-debug.log

请帮助我。谢谢!

2 个答案:

答案 0 :(得分:0)

请卸载您的全局无服务器并清除缓存

npm uninstall -g serverless

npm cache clear --force

答案 1 :(得分:0)

第一

npm cache clean --force

要将所有软件包更新到新的主要版本,请全局安装npm-check-updates软件包:

npm install -g npm-check-updates

然后运行它:

ncu -u

这会将package.json文件中的所有版本提示升级为依赖关系和devDependencies,因此npm可以安装新的主要版本。

您现在可以运行更新了:

npm update

然后install your package