question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[ERROR] svelte.config.cjs should be renamed to svelte.config.js and converted to an ES module

See original GitHub issue

Describe the bug - Log svelte.config.cjs should be renamed to svelte.config.js and converted to an ES module. See https://kit.svelte.dev/docs#configuration for an example

To Reproduce This is the weirdest issue ever i got i installed this https://github.com/SharifClick/svelte-swipe its giving me the error below

i delete its it same , i remove all .svelte and node_modules , still same error 😭

Expected behavior its should not throw any error, after removeing all the node_modules + .svelte , and install package.json again

Stack trace
> svelte-kit dev

svelte.config.cjs should be renamed to svelte.config.js and converted to an ES module. See https://kit.svelte.dev/docs#configuration for an example
No "exports" main defined in /study/spacefoot/xxxxxxxxxx/node_modules/@sveltejs/adapter-node/package.json
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /study/spacefoot/xxxxxxxxxx/node_modules/@sveltejs/adapter-node/package.json
    at throwExportsNotFound (internal/modules/esm/resolve.js:290:9)
    at packageExportsResolve (internal/modules/esm/resolve.js:479:7)
    at resolveExports (internal/modules/cjs/loader.js:432:36)
    at Function.Module._findPath (internal/modules/cjs/loader.js:472:31)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:867:27)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/study/spacefoot/xxxxxxxxxx/svelte.config.cjs:2:17)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)

Information about your SvelteKit Installation:

Diagnostics
  System:
    OS: Linux 4.19 Debian GNU/Linux 10 (buster) 10 (buster)
    CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
    Memory: 2.62 GB / 7.71 GB
    Container: Yes
    Shell: 5.0.3 - /bin/bash
  Binaries:
    Node: 14.16.0 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/bin/yarn
    npm: 6.14.11 - /usr/local/bin/npm
  Browsers:
    Chromium: 90.0.4430.93
  npmPackages:
    @sveltejs/kit: ^1.0.0-next.92 => 1.0.0-next.99 
    svelte: ^3.38.1 => 3.38.2 
    vite: ^2.2.3 => 2.2.4 

  • Your adapter (e.g. Node, static, Vercel, Begin, etc…) node

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
dummdidummcommented, May 10, 2021
1reaction
Conduitrycommented, May 5, 2021

You need to rename your config file, rewrite it with ESM imports/exports, and update the version of the adapter you’re using.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Alternative to loading svelte.config.js ? · Issue #6 - GitHub
js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules. Instead rename...
Read more >
Error in svelte.config.js Syntax Error: Cannot use import ...
You're likely not using "type": "module" in your package.json ... I fixed the issue by setting up Svelte Language-server: Runtime on VSCode.
Read more >
Configuration • Docs • SvelteKit
Your project's configuration lives in a svelte.config.js file at the root of your project. As well as SvelteKit, this config object is used...
Read more >
How to Set Up SvelteKit with Tailwind CSS
A quick 3 step guide for myself on how to set up Svelte with Tailwind CSS.
Read more >
https://unpkg.com/@sveltejs/vite-plugin-svelte@1.0...
__esModule && "default" in module2 ? ... existsSync(abolutePath)) { throw new Error(`failed to find svelte config file ${abolutePath}.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found