libsql-client-ts
libsql-client-ts copied to clipboard
@libsql/client Module parse failed: Unexpected character ' ' (1:1)
I’m using this package with NEXT.js and trying to Connect to Turso database. I’m getting this error ` ⨯ ./node_modules/@libsql/darwin-x64/README.md Module parse failed: Unexpected character ' ' (1:1) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
@libsql/darwin-x64
|
| Prebuilt binary package for libsql on darwin-x64.
Import trace for requested module: ./node_modules/@libsql/darwin-x64/README.md ./node_modules/@libsql/ ./node_modules/@libsql/ sync ^./.*$ ./node_modules/libsql/index.js ./node_modules/@libsql/client/lib-esm/sqlite3.js ./node_modules/@libsql/client/lib-esm/node.js ./src/app/lib/prisma.ts ./src/app/page.tsx `
@draqo666 What version of Next.js is this? The issue is supposed to be fixed in recent versions that have the following bug fix: https://github.com/vercel/next.js/pull/56192
@penberg I'm also facing the same issue in [email protected] and drizzle-orm@^0.29.3. I'm using drizzle queries inside zustand
Error from client(browser):
./node_modules/.pnpm/@[email protected]/node_modules/@libsql/hrana-client/LICENSE
Module parse failed: Unexpected token (1:4)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> MIT License
|
| Copyright 2023 the sqld authors
~~I am getting the same problem. I'll keep getting build errors with [email protected], [email protected] and [email protected], [email protected]~~
Failed to compile.
./node_modules/@libsql/darwin-arm64/README.md
Module parse failed: Unexpected character ' ' (1:1)
You may need an appropriate loader to handle this file type, currently, no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> # `@libsql/darwin-arm64`
|
| Prebuilt binary package for `libsql` on `darwin-arm64`.
The whole error message
> next build
▲ Next.js 14.1.3
- Environments: .env
Creating an optimized production build ...
Failed to compile.
./node_modules/@libsql/darwin-arm64/README.md
Module parse failed: Unexpected character ' ' (1:1)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> # `@libsql/darwin-arm64`
|
| Prebuilt binary package for `libsql` on `darwin-arm64`.
Import trace for requested module:
./node_modules/@libsql/darwin-arm64/README.md
./node_modules/@libsql/ ./node_modules/@libsql/ sync ^\.\/.*$
./node_modules/libsql/index.js
./node_modules/@libsql/client/lib-esm/sqlite3.js
./node_modules/@libsql/client/lib-esm/node.js
./src/lib/db.ts
./src/actions/contact/save.ts
./node_modules/@libsql/darwin-arm64/index.node
Module parse failed: Unexpected character '�' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
Import trace for requested module:
./node_modules/@libsql/darwin-arm64/index.node
./node_modules/@libsql/ ./node_modules/@libsql/ sync ^\.\/.*$
./node_modules/libsql/index.js
./node_modules/@libsql/client/lib-esm/sqlite3.js
./node_modules/@libsql/client/lib-esm/node.js
./src/lib/db.ts
./src/actions/contact/save.ts
./node_modules/@libsql/hrana-client/LICENSE
Module parse failed: Unexpected token (1:4)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> MIT License
|
| Copyright 2023 the sqld authors
Import trace for requested module:
./node_modules/@libsql/hrana-client/LICENSE
./node_modules/@libsql/ ./node_modules/@libsql/ sync ^\.\/.*$
./node_modules/libsql/index.js
./node_modules/@libsql/client/lib-esm/sqlite3.js
./node_modules/@libsql/client/lib-esm/node.js
./src/lib/db.ts
./src/actions/contact/save.ts
./node_modules/@libsql/hrana-client/README.md
Module parse failed: Unexpected character ' ' (1:1)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> # Hrana client for TypeScript
|
| **[API docs][docs] | [Github][github] | [npm][npm]**
Import trace for requested module:
./node_modules/@libsql/hrana-client/README.md
./node_modules/@libsql/ ./node_modules/@libsql/ sync ^\.\/.*$
./node_modules/libsql/index.js
./node_modules/@libsql/client/lib-esm/sqlite3.js
./node_modules/@libsql/client/lib-esm/node.js
./src/lib/db.ts
./src/actions/contact/save.ts
./node_modules/@libsql/hrana-client/node_modules/node-fetch/LICENSE.md
Module parse failed: Unexpected token (1:4)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> The MIT License (MIT)
|
| Copyright (c) 2016 - 2020 Node Fetch Team
Import trace for requested module:
./node_modules/@libsql/hrana-client/node_modules/node-fetch/LICENSE.md
./node_modules/@libsql/ ./node_modules/@libsql/ sync ^\.\/.*$
./node_modules/libsql/index.js
./node_modules/@libsql/client/lib-esm/sqlite3.js
./node_modules/@libsql/client/lib-esm/node.js
./src/lib/db.ts
./src/actions/contact/save.ts
> Build failed because of webpack errors
Update
I noticed that I didn't use use server for one of my server components. When I add that the build has succeeded.
I did not try this but I think this could work.
Manually add the package to serverComponentsExternalPackages (see https://github.com/vercel/next.js/blob/canary/docs/02-app/02-api-reference/05-next-config-js/serverComponentsExternalPackages.mdx)
@Jolg42 While I was trying to share my error message (thank you for being my yellow rubber duck today 😄) I noticed that one of my components is showing up in every time. When I checked it I saw that I forgot to add 🤦 use server on top of it. I added it and now the build is passing.
I faced this issue today, and fixed it with import it with web like that
import {} from "@libsql/client/web"
Any updates on this issue? Running into this when using a libsql call with atproto's node oauth library in a route.ts file on nextjs.
Any updates on this issue? Running into this when using a libsql call with atproto's node oauth library in a route.ts file on nextjs.
I found this comment which solved my problem @Lermatroid
https://github.com/tursodatabase/libsql-client-ts/issues/201#issuecomment-2160954111
try adding serverExternalPackages: ["@libsql/client"], to your next config.