New to Netlify, and I am trying to get the local server to load the index.html file.
My netlify.toml file looks like this:
[dev]
command = "npm run serve"
functions = "lambda"
publish = "src/"
[build]
functions = "lambda"
publish = "src/"
# The following redirect is intended for use with most SPAs that handle
# routing internally.
[[redirects]]
from = "/*"
to = "index.html"
status = 200
[[headers]]
# Define which paths this specific [[headers]] block will cover.
for = "/*"
[headers.values]
Access-Control-Allow-Origin = "*"
Can you provide more information on how you are trying to run your site locally? Netlify-lambda will only host your functions and nothing else. You’ll need at least the netlify-cli (cli/dev.md at main · netlify/cli · GitHub) to test your site locally.
I’m following the tutorial here: Netlify-faunadb-example
It allows me to run on a local server, but I am confused on how to properly format the output.
Could you share the output of your terminal once running npm start? The start command defined in the project you linked to indeed does run netlify dev but I’m curious why you’re trying to hit port 9000
Or are you kicking everything off by running netlify dev yourself? In which case, your [dev]=>command is different from the one in the tutorial you linked to
Took me a little while, but it turns out port 9000 is used by netlify-lambda
npm run start results in
npm ERR! missing script: start
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\DellDesk\AppData\Roaming\npm-cache\_logs\2020-08-11T12_35_04_995Z-debug.log
What command are you using to start your local development process? And what is the full output of that command, if you don’t mind sharing? I think that’ll help explain a lot of the trouble you’re seeing
Okay, awesome. I think I understand where you’re coming from. The short story is that you’re going to want to be running netlify dev as the command to kick off your local development process, not npm run serve. I think the tutorial you’re following is geared to have you run netlify dev locally too, but your code differs from the tutorial in some ways there.
I’d highly recommend reading through this document to get a better understanding of what it means to run Netlify locally. I think it’ll help you better understand how to get things running smoothly