Migrating a single page JS webapp to Netlify Functions for env secret token hider

site name: trevor4n-sutton.netlify.app site link

Build + Serverless Function netlify.toml package.json

Any help would be appreciated! Serverless stuff is super new to me :slight_smile:

The error is right at the start…

npm ERR! Missing script: “build”
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR! npm run

If you look in your package.json you can see:

"scripts": {
  "test": "echo \"Error: no test specified\" && exit 1"

There is no build script specified there.

The only script is test and it’s just the default one.

If you’re going to run npm run build from Netlify, then specify your actual build command in the package.json e.g.

"scripts": {
1 Like

Hiya, sorry you are having trouble with your build.

This Support Guide contains a ton of useful debugging tips that can likely help you solve your problem :slight_smile: Additionally, this Support Guide houses all of our resources for debugging build and deploy issues.

1 Like

In order to satisfy the:

  • netlify.toml’s usage for declaring the serverless function directory
  • package.json’s unnecessary build command for simple single-page webapps that aren’t being webpacked etc…

I set my package.json > scripts >
"build": "echo \"setting env to prod \" & cross-env NODE_ENV=production &",

Looks like you’ve fixed the issue @trevor4n?