5

When running webpack I have received this error "WARNING in ./node_modules/sharp/build/Release/sharp.node 1: 0 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) @ ./node_modules/sharp/lib/constructor.js 11: 2-40 @ ./node_modules/sharp/lib/index.js "

Sharp was installed with the yarn add. My operating system is ubuntu 18.04 x86_64. How can I solve this problem?

1 Answer 1

9

If you use webpack, use node-loader

Install it: npm i -D node-loader

In webpack.config.js:

module: {
  rules: [
    { test: /\.ts$/, loader: "ts-loader" },  
    { test: /\.node$/, use: "node-loader"}
  ]
}
Sign up to request clarification or add additional context in comments.

Comments

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.