0

I am having a problem downloading the Sharp dependency for my Next.js project v15.5.6. I've tried reinstalling Node.js, but it still fails.

Below is the failure message after running npm install sharp --verbose

npm info run [email protected] install node_modules/sharp node install/check.js
npm info run [email protected] install { code: 'ERR_INVALID_ARG_TYPE', signal: undefined }
npm verbose stack TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received undefined
npm verbose stack     at normalizeSpawnArguments (node:child_process:567:3)
npm verbose stack     at spawn (node:child_process:780:13)

I've also downloaded libvips and added the bin to my PATH, however, it still fails to download.

How to I fix this?

Clarifying Notes:

  • I am using Node.js 22.21.0
  • I am using Windows 11
4
  • What Node.js version are you using? Commented Oct 25 at 10:35
  • I am using Node.js v22.21.0 Commented Oct 25 at 20:32
  • What OS are you using? It looks like the installation script tried to build the native sources and failed somewhere there Commented Oct 25 at 20:46
  • I am using Windows 11 as my OS Commented Oct 25 at 23:41

1 Answer 1

0

Try downgrading to Node v.18 or 20 and run

npm install sharp --unsafe-perm
Sign up to request clarification or add additional context in comments.

2 Comments

I recieved this message: npm info run [email protected] install { code: 'ERR_INVALID_ARG_TYPE', signal: undefined } npm warn cleanup [Error: EPERM: operation not permitted, rmdir 'C:\----\node_modules\next\dist\esm\build\webpack\config\blocks\images'] { npm warn cleanup errno: -4048, npm warn cleanup code: 'EPERM', npm warn cleanup syscall: 'rmdir', npm warn cleanup path: 'C:\\------\\node_modules\\next\\dist\\esm\\build\\webpack\\config\\blocks\\images'
I used nvm for windows to use node 18 and it did switch the node version too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.