Reputation: 5954
I am trying to use the serverless-offline library, using the serverless framework,
I have the serverless.yaml file properly configured, with the -
plugins:
- serverless-offline
added to it.
Following is my 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"
}
}
I used the following command to install the packages -
npm i
also ran -
npm i dev
And ran sls offline
and serverless offline
to run the offline mode.
But I am getting the following error -
bash: sls: command not found
and
bash: serveless: command not found
I checked the npm logs and found this -
112 error code EBADPLATFORM
113 error notsup Unsupported platform for [email protected]: 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 ]
I could use the serverless-offline fine on ubuntu,
But unable to so do on Mac,
Is there a solution to this?
Upvotes: 5
Views: 10582
Reputation: 7245
Your problem is not with the serverless offline
plugin but with the Serverless Framework instead: it is not installed, thus you get
sls (or serverless) command not found
Just run npm install serverless -g
. Keep in mind that depending how you have set up npm
you may need sudo
permissions to install packages globally.
Upvotes: 9