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

Install succeeds, but running fails in WSL #1108

Closed
bogdan-calapod opened this issue Jan 30, 2018 · 4 comments
Closed

Install succeeds, but running fails in WSL #1108

bogdan-calapod opened this issue Jan 30, 2018 · 4 comments
Labels

Comments

@bogdan-calapod
Copy link

bogdan-calapod commented Jan 30, 2018

Hello,

I've been trying to add Sharp to a project I'm working on.

This is the environment I'm using:

  • OS: Windows 10 Fall Creators Update (build 1709) with Windows Subsystem for Linux installed (Ubuntu from Windows Store)
  • Node version: v9.4.0

Installation goes on fine, but running it fails with the following error:

module.js:689
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: librsvg-2.so.2: cannot enable executable stack as shared object requires: Invalid argument
    at Object.Module._extensions..node (module.js:689:18)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
    at Module.require (module.js:604:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/mnt/c/Users/Bogdan Calapod/Repos/TechLounge/harmonia/node_modules/sharp/lib/constructor.js:10:15)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)

What's interesting is that it fails on just including sharp.

What I've tried:

  • rm -rf node_modules && yarn cache clean
  • Installing libvips and libvips-dev
  • Uninstalling and reinstalling node
  • Downgrading to node v8.9.4

Steps to reproduce:

  • npm init and npm install --save sharp
  • Create a file with only const sharp = require('sharp')
  • node index.js

It will fail with the above error.

Any ideas ? Is there any debug flag that I can set to see more info about what's happening?

@lovell
Copy link
Owner

lovell commented Jan 30, 2018

A web search for "cannot enable executable stack as shared object" returns microsoft/WSL#286 which has some suggestions.

@bogdan-calapod
Copy link
Author

I've looked over the issues posted, it seems to have something to do with executable stack not being supported yet on WSL.

I tried playing around with execstack -c as the commenters suggested, but got a bit over my head. Well, I guess it's a WSL issue, not a sharp one after all.

Thanks for your effort!

@lovell
Copy link
Owner

lovell commented Jan 30, 2018

Running execstack -c node_modules/sharp/vendor/lib/librsvg-2.so.2 might fix this.

It's possible librsvg has the execstack flag set for a reason, perhaps function trampolines are used due to the mix of Rust and C sources?

I've created lovell/sharp-libvips#3 to investigate what, if anything, can be done.

@lovell lovell closed this as completed Jan 30, 2018
@knoxcard
Copy link

knoxcard commented Feb 13, 2018

This worked wonders for me on a Windows installation...

set GYP_MSVS_VERSION=2015
npm install --msvs_version=2015
npm install node-gyp -g
npm install sharp

Using Yarn?
I went into a different directory and just installed it there, it's all global so it works. Also did this so it wouldn't conflict with my yarn node_modules folder.

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

No branches or pull requests

3 participants