Automattic / Automattic/node-canvas

Webpack node-loader - Error: libgif.so.7: No such file or directory / Error: /lib/x86_64-linux-gnu/libjpeg.so.62: version `LIBJPEGTURBO_6.2' not found

Open
#1,723 2 comments 1 reaction 0 assignees View on GitHub
Installation help
Dominant language
JavaScript
Stars
10.7k
Forks
1.2k
Avg merge
4d 8h
Merged PRs (30d)
1

Description

## Issue
Using Node v10.23.0 with TypeScript and Webpack.

Attempting to **locally** build and run my project with Webpack results in the error:

```
(node:8833) UnhandledPromiseRejectionWarning: Error: node-loader:
Error: /lib/x86_64-linux-gnu/libjpeg.so.62: version `LIBJPEGTURBO_6.2' not found (required by /home/mysterise/projects/mystbot/dist/1ac5511a17d7ad694cfe905612b1d208.node)
```

Attempting the same build, **but in a node:10 base docker image** results in a similar but slightly different error:

```
(node:72) UnhandledPromiseRejectionWarning: Error: node-loader:
Error: libgif.so.7: cannot open shared object file: No such file or directory
```

This is with the following relevant Webpack configuration for loading the Canvas dependencies:

```javascript
module.exports = {
...,
resolve: {
modules: ['src', 'node_modules'],
extensions: [ '.ts', '.js', '.json', '.node' ],
},
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.node$/,
loader: 'node-loader'
}
]
}
};
```

## Additional Information

**Running the project source directly with `ts-node` (development) rather than building with Webpack (production) does not have this issue.**

Canvas is installed normally without `--build-from-source`.

`libjpeg62` is installed and up to date.
```
libjpeg62/focal,now 1:6b2-3 amd64
```

## Your Environment
* Version of node-canvas (output of `npm list canvas` or `yarn list canvas`): **canvas@2.6.1**
* Environment (e.g. node 4.2.0 on Mac OS X 10.8):
- Local: **node v10.23.0 on WSL2 Ubuntu 20.04 LTS**
- Docker: **node:10**

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.