Coder Social home page Coder Social logo

Comments (8)

SerinaNya avatar SerinaNya commented on May 28, 2024 2

GOOD NEWS

I've found a temporary solution.

# sharp and sharp-libvips prebuilt binaries
# dont need node-gyp
export npm_config_sharp_binary_host=https://npmmirror.com/mirrors/sharp
export npm_config_sharp_libvips_binary_host=https://npmmirror.com/mirrors/sharp-libvips

pnpm i

# then it can works
pnpm dev
# or
pnpm build

During the installation process, I noticed that the root cause of this issue lies in the post-install script of @sveltejs\kit is stuck by the install script of sharp!!!

So I set 2 environment variables to use the prebuilt binaries of sharp. While the install script of sharp runs successfully, the post-install script of @sveltejs\kit will finish as well.

from svelte-qwer.

kwchang0831 avatar kwchang0831 commented on May 28, 2024 1

I have faced the same problem with sharp installation.
I searched for a couple of hours and could not find any solid solution for both Windows and Linux.
I tried to clean up

rm node_modules QWER/node_modules -rf
rm pnpm-lock.yaml

And included Sharp in the devDependencies.
It seemed to work.
(I do vercel build locally and deploy pre-built to the production. I assumed just do deploy might not work, the "sharp" module installation error will probably show up.)

Thanks for your temporary solution @jinzhijie.

from svelte-qwer.

vai avatar vai commented on May 28, 2024 1

I can confirm that I removed the node_modules and lock file, then ran 
pnpm i -d sharp -w and pnpm dev and pnpm build and pnpm preview now succeed.

from svelte-qwer.

vai avatar vai commented on May 28, 2024 1

Didn't mean to close the issue (tab to next field should hit comment, not close!)

The sharp dependency is now in devDependencies though, so this should likely be closed, but I don't know your process.

from svelte-qwer.

kwchang0831 avatar kwchang0831 commented on May 28, 2024 1

If you feel the issue is resolved for you, feel free to close :D
If you let me decide, I will keep it open for now... So I will make sure I remember to investigate this issue again later in the future to see if the issue is still there.

If the issue still happens... do the following

pnpm i --ignore-scripts
pnpm i -d sharp -w
pnpm dev
pnpm build

Just tested fresh install. It gets done but takes a bit long...

Running postinstall script, done in 4m 9s

from svelte-qwer.

vai avatar vai commented on May 28, 2024 1

Works for me.

from svelte-qwer.

kwchang0831 avatar kwchang0831 commented on May 28, 2024

Not only on Windows, it also happens on Linux. I have upgraded the deps, but does not seem to help.

Update to the latest, and use --ignore-scripts flag for pnpm for now.

pnpm i --ignore-scripts

from svelte-qwer.

SerinaNya avatar SerinaNya commented on May 28, 2024

Not only on Windows, it also happens on Linux. I have upgraded the deps, but does not seem to help.

Update to the latest, and use --ignore-scripts flag for pnpm for now.

pnpm i --ignore-scripts

I'v got the same problem.

I've tried to follow your instruction. However, when I run pnpm build it throws errors below. 😢

> @kwchang0831/[email protected] build:i18n /example.com-qwer
> npx typesafe-i18n --no-watch

[typesafe-i18n] version 5.25.1
[typesafe-i18n] generating files for TypeScript version: '5.1.x'
[typesafe-i18n] options: { adapter: 'svelte', esmImports: true }
[typesafe-i18n] generated file: './src/i18n/i18n-types.ts'
[typesafe-i18n] ... all files are up to date
[typesafe-i18n] generating files completed

> @kwchang0831/[email protected] build:partytown /example.com-qwer
> partytown copylib static/~partytown

Partytown lib copied to: /example.com-qwer/static/~partytown

> @kwchang0831/[email protected] build:sveltekit /example.com-qwer
> vite build

▲ [WARNING] Cannot find base config file "./.svelte-kit/tsconfig.json" [tsconfig.json]

    tsconfig.json:2:13:
      2 │   "extends": "./.svelte-kit/tsconfig.json",
        ╵              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

failed to load config from /example.com-qwer/vite.config.js
error during build:
Error: 
Something went wrong installing the "sharp" module

Cannot find module '../build/Release/sharp-linuxmusl-x64.node'
Require stack:
- /example.com-qwer/node_modules/.pnpm/[email protected]/node_modules/sharp/lib/sharp.js
- /example.com-qwer/node_modules/.pnpm/[email protected]/node_modules/sharp/lib/constructor.js
- /example.com-qwer/node_modules/.pnpm/[email protected]/node_modules/sharp/lib/index.js

Possible solutions:
- Install with verbose logging and look for errors: "npm install --ignore-scripts=false --foreground-scripts --verbose sharp"
- Install for the current linuxmusl-x64 runtime: "npm install --platform=linuxmusl --arch=x64 sharp"
- Consult the installation documentation: https://sharp.pixelplumbing.com/install
    at Object.<anonymous> (/example.com-qwer/node_modules/.pnpm/[email protected]/node_modules/sharp/lib/sharp.js:37:9)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (/example.com-qwer/node_modules/.pnpm/[email protected]/node_modules/sharp/lib/constructor.js:11:1)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
 ELIFECYCLE  Command failed with exit code 1.
ERROR: "build:sveltekit" exited with 1.
 ELIFECYCLE  Command failed with exit code 1.

from svelte-qwer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.