amazon-web-services - 在 Linuxmint 20.1 上安装无服务器时出错
问题描述
我想将无服务器安装为全局。
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 缓存,npm cache clean --force
我又试了一次,又遇到了这样的错误
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
请帮我。谢谢!
解决方案
第一的
npm cache clean --force
第二
要将所有包更新到新的主要版本,请全局安装 npm-check-updates 包:
npm install -g npm-check-updates
然后运行它:
ncu -u
这会将 package.json 文件中的所有版本提示升级为依赖项和 devDependencies,因此 npm 可以安装新的主要版本。
您现在已准备好运行更新:
npm update
然后install your package
推荐阅读
- autodesk-forge - 在 Forge Viewer 中无法选择 Revit“零件”
- python - 比较列表并查找组合
- reactjs - 在 React 中导入 MATLAB 文件
- javascript - 使用 Hooks 访问嵌套的 json 数据
- python - 如何清除一个numpy数组?
- google-apps-script - 我对缩短代码和使用特定范围的方法有疑问
- powerbi - 有没有办法在 PowerBI 中检测新输入并每月更改其状态?
- list - 获取列表中的特定值
- scala - org.apache.commons.commons-email 和 spark 之间的回归问题
- clojure - clj-time - 如何从不同时区的当前时间获取本地日期