kit icon indicating copy to clipboard operation
kit copied to clipboard

Error: No loader is configured for ".node" files: node_modules/fsevents/fsevents.node

Open xmlking opened this issue 2 years ago • 3 comments

Describe the bug

just updated to latest svelte version, I am seeing this error occasionally. it is not happening consistently :(

✘ [ERROR] No loader is configured for ".node" files: node_modules/fsevents/fsevents.node

node_modules/fsevents/fsevents.js:13:23:
  13 │ const Native = require("./fsevents.node");
     ╵                        ~~~~~~~~~~~~~~~~~

6:36:27 PM [vite-plugin-svelte] prebundle libraries done. package files time avg svelte-starter-kit 482 2.74s 5.7ms 6:36:27 PM [vite] error while updating dependencies: Error: Build failed with 1 error: node_modules/fsevents/fsevents.js:13:23: ERROR: No loader is configured for ".node" files: node_modules/fsevents/fsevents.node at failureErrorWithLog (/Users/schinth/Developer/Work/SPA/svelte-starter-kit/node_modules/esbuild/lib/main.js:1591:15) at /Users/schinth/Developer/Work/SPA/svelte-starter-kit/node_modules/esbuild/lib/main.js:1047:28 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) hooks.server.ts, HandleFetch: errors null

image

Reproduction

Repo: https://github.com/xmlking/svelte-starter-kit.git

Logs

package                 files    time     avg
svelte-starter-kit        536   0.92s   1.7ms
6:36:23 PM [vite-plugin-svelte] prebundle libraries in progress ...
6:36:27 PM [vite-plugin-svelte] /src/lib/blocks/dashboard/Header1.svelte:20:3 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:36:27 PM [vite-plugin-svelte] /src/lib/blocks/dashboard/Header1.svelte:30:3 A11y: visible, non-interactive elements with an on:click event must be accompanied by an on:keydown, on:keyup, or on:keypress event.
6:36:27 PM [vite-plugin-svelte] /src/lib/components/PreloadingIndicator.svelte:52:1 Unused CSS selector ":global(html).dark .fade"
✘ [ERROR] No loader is configured for ".node" files: node_modules/fsevents/fsevents.node

    node_modules/fsevents/fsevents.js:13:23:
      13 │ const Native = require("./fsevents.node");
         ╵                        ~~~~~~~~~~~~~~~~~

6:36:27 PM [vite-plugin-svelte] prebundle libraries done.
package                 files    time     avg
svelte-starter-kit        482   2.74s   5.7ms
6:36:27 PM [vite] error while updating dependencies:
Error: Build failed with 1 error:
node_modules/fsevents/fsevents.js:13:23: ERROR: No loader is configured for ".node" files: node_modules/fsevents/fsevents.node
    at failureErrorWithLog (/Users/schinth/Developer/Work/SPA/svelte-starter-kit/node_modules/esbuild/lib/main.js:1591:15)
    at /Users/schinth/Developer/Work/SPA/svelte-starter-kit/node_modules/esbuild/lib/main.js:1047:28
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
hooks.server.ts, HandleFetch:

System Info

npx envinfo --system --binaries --browsers --npmPackages "{svelte,@sveltejs/*,vite}"                                                                                ☸ elrprdusr001_cs-sre_cs-sre-hcc-naas-admin (cs-sre) 
Need to install the following packages:
  [email protected]
Ok to proceed? (y) 

  System:
    OS: macOS 12.6.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 1.63 GB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.9.0 - ~/homebrew/bin/node
    npm: 8.19.1 - ~/homebrew/bin/npm
  Browsers:
    Chrome: 108.0.5359.98
    Safari: 16.1
  npmPackages:
    @sveltejs/adapter-auto: 1.0.0-next.90 => 1.0.0-next.90 
    @sveltejs/adapter-node: 1.0.0-next.104 => 1.0.0-next.104 
    @sveltejs/adapter-static: 1.0.0-next.49 => 1.0.0-next.49 
    @sveltejs/kit: 1.0.0-next.587 => 1.0.0-next.587 
    svelte: 3.55.0 => 3.55.0 
    vite: 4.0.1 => 4.0.1

Severity

annoyance

Additional Information

No response

xmlking avatar Dec 14 '22 02:12 xmlking

I have the same issue. I am running on the latest Svelte versions as of Jan 2, 2023.

npx envinfo --system --binaries --browsers --npmPackages "{svelte,@sveltejs/*,vite}"                                                                        
Need to install the following packages:
  [email protected]
Ok to proceed? (y) y

  System:
    OS: macOS 13.1
    CPU: (8) arm64 Apple M1
    Memory: 50.94 MB / 8.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 19.2.0 - /opt/homebrew/bin/node
    npm: 8.19.3 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 108.0.5359.124
    Safari: 16.2
  npmPackages:
    @sveltejs/adapter-auto: ^1.0.0 => 1.0.0 
    @sveltejs/kit: ^1.0.1 => 1.0.1 
    @sveltejs/package: ^1.0.1 => 1.0.1 
    svelte: ^3.55.0 => 3.55.0 
    vite: ^4.0.3 => 4.0.3 

Error: SCR-20230102-h5m

spabolu avatar Jan 02 '23 19:01 spabolu

Same here. This is not an issue of the adapter though, it is a compatibility issue on the library side (unfortunately a very common thing).

vorcigernix avatar Jan 03 '23 10:01 vorcigernix

Encountered the same problem, now what is the solution

Soya-xy avatar Jan 12 '23 01:01 Soya-xy

Same problem here.

PaHell avatar Feb 02 '23 08:02 PaHell

Same here, happened all of a sudden and can't seem to get rid of it. (tried to remove node_modules and .svelte-kit)

EDIT: seems like VisualCode had auto imported import { loadConfigFromFile } from 'vite' for me and when I removed that the error dissapeared

tedsteen avatar Feb 11 '23 18:02 tedsteen

Same here, happened all of a sudden and can't seem to get rid of it. (tried to remove node_modules and .svelte-kit)

EDIT: seems like VisualCode had auto imported import { loadConfigFromFile } from 'vite' for me and when I removed that the error dissapeared

I had the exact same issue!

oxisto avatar Feb 11 '23 19:02 oxisto

@xmlking Please update the repo with a proper minimal reproduction as instructed

A link to a repository, or a fork of https://node.new/sveltekit, that reproduces the issue. Reproductions must be short, self-contained and correct and must not contain files or code that aren't relevant to the issue — please do NOT just paste a link to your project.

if you're still running into this otherwise close the issue.

gtm-nayan avatar Feb 19 '23 15:02 gtm-nayan

Closing as no minimal reproduction was provided. Feel free to open a new issue with one.

Rich-Harris avatar Mar 02 '23 19:03 Rich-Harris

Based on this stack overflow: https://stackoverflow.com/questions/46929196/how-to-solve-npm-install-throwing-fsevents-warning-on-non-mac-os

I deleted node_modules, and then did a npm install --no-optional and it made the issue go away (just deleting and doing npm install had no effect)

RobKohr avatar Mar 09 '23 01:03 RobKohr

I'd say that this will work only in case that confliction package is one of optional dependencies.

On Thu, Mar 9, 2023, 2:09 AM RobKohr @.***> wrote:

Based on this stack overflow:

https://stackoverflow.com/questions/46929196/how-to-solve-npm-install-throwing-fsevents-warning-on-non-mac-os

I deleted node_modules, and then did a npm install --no-optional and it made the issue go away (just deleting and doing npm install had no effect)

— Reply to this email directly, view it on GitHub https://github.com/sveltejs/kit/issues/8140#issuecomment-1461110510, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABLZOEWP5MORMXAQF2IZKTW3EUTRANCNFSM6AAAAAAS55MJYY . You are receiving this because you commented.Message ID: @.***>

vorcigernix avatar Mar 09 '23 06:03 vorcigernix

Not sure if this relevant anymore but I noticed I got the error when I had accidentally imported something that you're not supposed to load / run in the client side. for me it was errors from playwright/test package.. 😅 Removed the unnecessary import and everything is fine.

aalakoski avatar Mar 27 '23 07:03 aalakoski

A number of people have reported that this occurs when vscode auto-imports a package which pulls in fsevents. I think it may be the Svelte extension. In my case, vscode helpfully pulled in 'send' from vite.

jb747 avatar Mar 30 '23 04:03 jb747

the only way for me was transpilation of fsevents with nuxt, ts in nuxt.config.ts:

export default { build: { transpile: ['fsevents'] } }

elmir-mammadli avatar May 15 '23 12:05 elmir-mammadli

Same here, happened all of a sudden and can't seem to get rid of it. (tried to remove node_modules and .svelte-kit)

EDIT: seems like VisualCode had auto imported import { loadConfigFromFile } from 'vite' for me and when I removed that the error dissapeared

thank you! I wasted ages on this and found a VS Code auto import import {sortUserPlugins} from 'vite'; for no reason other than to spoil my afternoon.

ccozens avatar Aug 04 '23 13:08 ccozens

I am also having the same issue and none of the solutions are working for me.

Build00rxyz avatar Sep 25 '23 01:09 Build00rxyz

For me, it VSCode auto-imported import { build } from 'vite'; which broke my app. You should probably look-out for any imports from vite in your app if you get this error.

plasmatech8 avatar Oct 08 '23 06:10 plasmatech8

For me removingimport { preview } from 'vite'; fixed the issue. Very strange behaviour.

WouS95 avatar Oct 20 '23 14:10 WouS95

ok, it seems to me this problem occurs if you type somehting fast and then not delete it xD happened to me, i wanted to write clg but accidentally wrote slg or something like that and it imported me:

import { splitVendorChunkPlugin } from 'vite';

Jauki avatar Dec 28 '23 18:12 Jauki

I have the same problem, can anyone tell me in which file did vs code auto import

 import { loadConfigFromFile } from 'vite'

YashK-194 avatar Jan 17 '24 12:01 YashK-194

Annoying auto-imports seem to happen all the time. Not sure how to improve that.

plasmatech8 avatar Jan 18 '24 02:01 plasmatech8

Found this to turn off auto imports https://stackoverflow.com/questions/47350589/how-to-disable-automatic-import-statements-in-vscode-october-2017

YashK-194 avatar Jan 18 '24 07:01 YashK-194

I have this same issue just from updating Nuxt from 3.7.0 to 3.9.3

carbontwelve avatar Jan 24 '24 16:01 carbontwelve

I checked if I had an accidental import from "vite" and didn't see any. I did try disabling all of my optimizeDeps in vite.config.ts, though, and that fixed it. I had made some changes recently to fix "changes detected, restarting server" by including and excluding various dependencies. So, adding "fsevents" to the exclude list for optimizeDeps fixed it:

optimizeDeps: {
  include: [<existing list>],
  exclude: [<existing list>, 'fsevents']
}

headquarters avatar Apr 11 '24 20:04 headquarters

Just got a similar error with Svelte 5.0.0-next.133, tried upgrading to Svelte 5.0.0-next.135, also SvelteKit 2.5.8. I've upgraded a lot of packages in the last day and dependabot has been fully broken on pnpm v9 ever since it was released months ago, so I wasn't able to upgrade packages "properly".

Difference is my errors were:

✘ [ERROR] No loader is configured for ".node" files: node_modules/.pnpm/@[email protected]/node_modules/@node-rs/bcrypt-darwin-arm64/bcrypt.darwin-arm64.node
    node_modules/.pnpm/@[email protected]/node_modules/@node-rs/bcrypt/binding.js:165:36:
      165 │             nativeBinding = require('@node-rs/bcrypt-darwin-arm64')

and

✘ [ERROR] No loader is configured for ".node" files: node_modules/.pnpm/@[email protected]/node_modules/@node-rs/argon2-darwin-arm64/argon2.darwin-arm64.node
    node_modules/.pnpm/@[email protected]/node_modules/@node-rs/argon2/index.js:173:36:
      173 │             nativeBinding = require('@node-rs/argon2-darwin-arm64')

Being that neither is a direct dependency of the project, I looked to oslo which pulls them in. I had just upgraded to oslo v1.2.0.

Adding this to my vite.config.ts fixed it:

	optimizeDeps: {
		exclude: ['@node-rs/argon2', '@node-rs/bcrypt']
	},

Thanks for all the clues above, everyone!

pboling avatar May 16 '24 14:05 pboling

Update: Thanks to https://github.com/sveltejs/kit/pull/12242, I was able to remove the code again after I updated to SvelteKit 2.5.10. 🥳


For me, this started happening in SvelteKit 2.5.8, I'm pretty sure due to the new automatic optimizeDeps.entries from this PR: https://github.com/sveltejs/kit/pull/12182

As others suggested, I was also able to fix it with:

optimizeDeps: { exclude: ['fsevents'] },

danieldiekmeier avatar May 17 '24 09:05 danieldiekmeier

@pboling Thank you, this worked for me https://github.com/sveltejs/kit/issues/8140#issuecomment-2115391217

	optimizeDeps: {
		exclude: ['@node-rs/argon2', '@node-rs/bcrypt']
	},

My original issue https://github.com/pilcrowOnPaper/oslo/issues/75

MahmoodKhalil57 avatar May 20 '24 20:05 MahmoodKhalil57

I am experiencing this issue too. In my case, I had added

		exclude: ['farmhash']

as indicated by the error message I got.

j-frost avatar May 21 '24 16:05 j-frost

Update: Thanks to https://github.com/sveltejs/kit/pull/12242, I was able to remove the code again after I updated to SvelteKit 2.5.10. 🥳

danieldiekmeier avatar May 23 '24 20:05 danieldiekmeier

I can confirm what @danieldiekmeier said, I was also able to remove my optimization after an upgrade to 2.5.10.

j-frost avatar May 24 '24 09:05 j-frost

Same, the "fix" is no longer needed!

pboling avatar May 24 '24 10:05 pboling