devalue icon indicating copy to clipboard operation
devalue copied to clipboard

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

Open elron opened this issue 3 years ago • 5 comments

Found duplicate: https://github.com/sveltejs/kit/issues/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

elron avatar Sep 01 '22 19:09 elron

Following the suggestion:

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

filipkowal avatar Sep 04 '22 20:09 filipkowal

@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!

sonyarianto avatar Sep 05 '22 14:09 sonyarianto

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

delaneyj avatar Sep 07 '22 02:09 delaneyj

Should be fixed now, see here: https://github.com/sveltejs/kit/issues/6462#issuecomment-1244680791

secondl1ght avatar Sep 13 '22 03:09 secondl1ght

Same issue here on devalue 4.0.1

W4G1 avatar Oct 26 '22 12:10 W4G1