Closed ndeitch closed 6 years ago
Have you checked the node_modules folder? is serverless-offline really installed?
I think this is a npm issue (try npm install
). Closing.
It's necessary to have all dependencies (even devDependencies) on deploy.
In Jenkins on deploy time We didn't have devDeps on node_modules
that's because I was getting that error.
I am having this problem, here are my deps:
"dependencies": {
"@octokit/rest": "^15.15.1",
"@types/axios": "^0.14.0",
"@types/node": "^10.12.1",
"axios": "^0.18.0",
"http": "0.0.0",
"proxy-agent": "^3.0.3"
},
"devDependencies": {
"@types/aws-lambda": "^8.10.14",
"serverless-offline": "^3.30.0",
"serverless-plugin-typescript": "^1.1.5"
}
Try remove your node_modules folder and run npm install
I've tried a few times, no dice. I Cleared out some npm proxy config settings, to see if that might be impacting things. Running npm audit, i get the below warnings:
───────────────┬──────────────────────────────────────────────────────────────┐ │ High │ Insufficient Entropy │ ├───────────────┼──────────────────────────────────────────────────────────────┤ │ Package │ cryptiles │ ├───────────────┼──────────────────────────────────────────────────────────────┤ │ Patched in │ >=4.1.2 │ ├───────────────┼──────────────────────────────────────────────────────────────┤ │ Dependency of │ serverless-offline [dev] │ ├───────────────┼──────────────────────────────────────────────────────────────┤ │ Path │ serverless-offline > hapi > cryptiles │ ├───────────────┼──────────────────────────────────────────────────────────────┤ │ More info │ https://nodesecurity.io/advisories/720 │ └───────────────┴──────────────────────────────────────────────────────────────┘
I found the issue... Plugins was nested under provider: I moved the plugins key to the bottom and offline starts fine.
The problem for me was that serverless-offline
is under devDependencies
. My CI server (like most others) only installs prod dependencies which caused a build failure.
It would be good if it were possible to deploy a project with serverless-offline
without moving it to dependencies
.
Workaround: move serverless-offline
from devDependencies
to dependencies
The problem for me was that
serverless-offline
is underdevDependencies
. My CI server (like most others) only installs prod dependencies which caused a build failure.It would be good if it were possible to deploy a project with
serverless-offline
without moving it todependencies
.Workaround: move
serverless-offline
fromdevDependencies
todependencies
same issue serverless-offline wouldnt work in devDependencies
I'd vote to re-open this issue, since it can't be an accepted solution to put serverless-offline to the dependencies, which is definitely a dev dependency!
I agree with @elin-y , serverless-offline is a very big package ( on disk size), which is another reason why putting serverless-offline to the dependencies is not a good idea.
This issue happens when you have NODE_ENV=production which excludes devDependencies
from being installed. The only solution is to either add those needed dependencies to dependencies
or NOT use NODE_ENV=production and instead rely on another mechanism for checking env in your code.
Yep, your NODE_ENV is probably "production", so it excludes installing devDependencies. (i also had this issue)
Hey,
I'm trying to deploy a serverless service, with the command line:
serverless deploy --package dist-qa --stage qa -v
But I get the following error:
Serverless plugin "serverless-offline" not found. Make sure it's installed and listed in the "plugins" section of your serverless config file.
I've a project in serverless
1.28.0
Here is my
devDependencies
frompackage.json
:Here is my
serverless.yml
:What am I doing wrong?