Rich-Harris/devalue

Error - No "exports" main defined in /var/task/node_modules/devalue/package.json

elron opened this issue · 5 comments

elron commented

Found duplicate: sveltejs/kit#6462

I get an error when trying to publish the latest sveltekit to netlify:
Error - No "exports" main defined in /var/task/node_modules/devalue/package.json

My Sveltekit project package.json:

        "devDependencies": {
		"@sveltejs/adapter-auto": "^1.0.0-next.71",
		"@sveltejs/kit": "next",
		"prettier": "^2.6.2",
		"prettier-plugin-svelte": "^2.7.0",
		"svelte": "^3.44.0",
		"svelte-check": "^2.7.1",
		"typescript": "^4.7.4",
		"vite": "^3.1.0-beta.1"
	},

Found more information here:
devalue import fails with adapter-node
devalue cause crash on Netlify after update

Following the suggestion:

  1. Make sure that packege.lock.json contains devalue@3.1.3 version
  2. Add devalue to noExternal array in ssr configuration in vite.config like:
const config = {
	plugins: [sveltekit()],
	ssr: {
		noExternal: ['devalue']
	}
};

@filipkowal wow this solved my problem on Vercel build as well :) Thank you. My steps are.

  • Remove package-lock.json (because still contains devalue 3.1.2)
  • Remove pnpm-lock.yaml (because still contains devalue 3.1.2)
  • Run pnpm install (will create fresh pnpm-lock.yaml)
  • I do your suggestion above
  • Build on Vercel
  • Build success!

Using straight ts-node (no vite or svelte) and hitting this same error.

pnpm-lock.yaml says

/devalue/3.1.3:
    resolution: {integrity: sha512-9KO89Cb+qjzf2CqdrH+NuLaqdk9GhDP5EhR4zlkR51dvuIaiqtlkDkGzLMShDemwUy21raSMdu+kpX8Enw3yGQ==}
    dev: false

Should be fixed now, see here: sveltejs/kit#6462 (comment)

W4G1 commented

Same issue here on devalue 4.0.1