Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting "node: symbol lookup" error when using function within express app? #26

Open
skeddles opened this issue Feb 19, 2019 · 2 comments

Comments

@skeddles
Copy link

skeddles commented Feb 19, 2019

So I'm having a really weird problem, where the script works fine when run by node, but when trying to implement it into my express app, it gets an error every time. Here is the error I'm getting:

node: symbol lookup error: /home/ubuntu/workspace/node_modules/canvas/build/Release/libpangoft2-1.0.so.0: undefined symbol: FcWeightFromOpenTypeDouble

And here is the full code of the route:

router.get('/test', function(req, res, next) {
  var text2png = require('text2png');
  
  var textImage = text2png('AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789', {
    font: 8+'px font',
    color: 'white',
    padding: 10,
    lineSpacing: 4,
    backgroundColor: '#332f35',
    localFontPath: 'renew.ttf',
    localFontName: 'font',
  });
  
  fs.writeFileSync('out.png', textImage);

});

But if I copy and paste that same code into it's own file, and run it with node file.js, it works perfectly and outputs the file.

I'm on Ubuntu 16.4.0

Hope we can resolve this as the script is great when it works!

@skeddles
Copy link
Author

After looking around some more, seems other people got that error which was caused by the package fontconfig, specifically the ubuntu version.

After testing my code in different positions, I've discovered it breaks whenever node-gd is included in the script before it's run.

Will continue to search for a solution.

@skeddles
Copy link
Author

I get the same problem with writing any text using node-canvas, so I'll open an issue with them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant