Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do you start serverless node server locally?

How do you start aws-lambda-serverless-node-6 server locally?

What I tried

# Followed the quick start instructions at https://serverless.com/framework/docs/providers/aws/guide/quick-start/
$ npm install
npm WARN saveError ENOENT: no such file or directory, open '/Redacted/package.json'
$ node server
Error: Cannot find module '/Redacted/server'

My ls output

$ ls
handler.js      package-lock.json   serverless.yml
like image 971
american-ninja-warrior Avatar asked Jan 31 '26 16:01

american-ninja-warrior


1 Answers

There are some steps in the tutorials that you skipped.

 npm install

You don't have the file package.json in your working directory. That is why you have the warning:

npm WARN saveError ENOENT: no such file or directory, open '/Redacted/package.json'

node server

You want to launch the node server but you don't have the module server.js resulting in the error

Error: Cannot find module '/Redacted/server'.

According the documentation, you should first run:

npm install -g serverless

An then you follow correctly the appropriate steps to create your service or to deploy the server.

like image 114
edkeveked Avatar answered Feb 02 '26 11:02

edkeveked