我正在尝试使用无服务器离线库,使用无服务器框架,
我正确配置了 serverless.yaml 文件,并带有 -
plugins:
- serverless-offline
添加到它。
以下是我的 package.json -
{
"name": "serverless-test",
"version": "1.0.0",
"description": "Lambda APIs for Test Module",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "./node_modules/.bin/serverless offline -s dev",
"debug": "export SLS_DEBUG=* && node --debug ./node_modules/.bin/serverless offline -s dev"
},
"author": "Aniruddha",
"license": "ISC",
"dependencies": {
"async": "^2.6.2",
"aws-sdk": "^2.447.0",
"axios": "^0.18.0",
"jsonwebtoken": "^8.5.1",
"moment": "^2.24.0",
"moment-timezone": "^0.5.25",
"mysql": "^2.17.1"
},
"devDependencies": {
"serverless-offline": "4.9.4"
}
}
我使用以下命令安装软件包 -
npm i
也跑了——
npm i dev
并运行sls offline
并serverless offline
运行离线模式。
但我收到以下错误 -
bash: sls: command not found
和
bash: serveless: command not found
我检查了 npm 日志,发现了这个 -
112 error code EBADPLATFORM
113 error notsup Unsupported platform for inotify@1.4.6: wanted {"os":"linux","arch":"any"} (current: {"os":"darwin","arch":"x64"})
114 error notsup Valid OS: linux
114 error notsup Valid Arch: any
114 error notsup Actual OS: darwin
114 error notsup Actual Arch: x64
115 verbose exit [ 1, true ]
我可以在 ubuntu 上使用 serverless-offline 很好,
但在 Mac 上不能这样做,
有解决方案吗?