Site is live and build succeeds but javascript error


This is a SvelteKit app. NODE_VERSION is set to 16 in netlify.toml and in netlify dashboard.

When loading up the page, I get Unexpected token '.' likely in reference to else if (allow?.length && cwd) {

I believe this is the cause, because when I change my local Node version to 12, that’s the error. But the site builds successfully with Node 14 or 16 both locally and on Netlify. Still, the site doesn’t load on Netlify because of this JS error.

When deploying, I get:

11:26:24 PM: Finished saving go dependencies

11:26:25 PM: Site is live :sparkles:

11:26:27 PM: Build script success

11:26:54 PM: Finished processing build request in 1m10.097739842s

Any ideas? Thanks!

1 Like

That is build time version and doesn’t affect the runtime version, which is the problem.

However, I don’t see why this problem would occur, because of two reasons:

  1. You have set the runtime version to 14.x in your environment already.
  2. Even if you had not, we already use Node 14 runtime by default.

Just to confirm, did you have nodejs12 set before? Did you try deploying after adding the nodejs14.x value?

Thanks for the quick reply.

In the Netlify UI environment variables, I have set: AWS_LAMBDA_JS_RUNTIME = nodejs14.x

I originally had nodejs version unset (defaulting to Netlify’s v14). I also tried explicitly setting V14 and V16.

I tried multiple “clear cache and redeploy” for each version change.

So far no success.

hey there @question_asker - could you provide a screenshot of where you are trying to set the js version exactly? We still think this is some kind of configuration issue.


  1. I removed all env variables in Netlify’s UI.
  2. to netlify.toml I added:
  node_bundler = "esbuild"

In my package.json:

"@sveltejs/adapter-netlify": "^1.0.0-next.0",
		"@sveltejs/kit": "^1.0.0-next.240",

Hi! You should be running the latest version of the adapter, which is currently 1.0.0-next.42. See the adapter docs for more info.

1 Like