failed to map segment from shared object
I am getting the following message any time I try to run gulp from the command line. I am new to gulp and npm so I assume it is something I have missed.
Error MSG:
`module.js:440 return process.dlopen(module, path._makeLong(filename)); ^
Error: /MYPATH/node_modules/node-sass/vendor/linux-x64-47/binding.node: failed to map segment from shared object
at Error (native)
at Object.Module._extensions..node (module.js:440:18)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.
Gulp File (direct copy from gulp-sass tutorial):
`'use strict';
var gulp = require('gulp'); var sass = require('gulp-sass');
gulp.task('sass', function () { return gulp.src('./src/sass/*/.scss') .pipe(sass.sync().on('error', sass.logError)) .pipe(gulp.dest('./css')); });
gulp.task('sass:watch', function () { gulp.watch('./src/sass/*/.scss', ['sass']); }); `
Package.json file:
{ "name": "tpfpv1", "version": "0.0.1", "description": "Build tasks", "main": "index.js", "author": "Shawn Taulien", "license": "MIT", "devDependencies": { "browser-sync": "latest", "gulp": "latest", "gulp-changed": "latest", "gulp-concat": "latest", "gulp-imagemin": "latest", "gulp-jshint": "latest", "gulp-sass": "latest", "gulp-uglify": "latest", "jshint": "latest", "fs": "latest", "gulp-minify-css": "latest" } }
I have removed and reinstalled NPM and all the gulp modules a few times and still get this same error message. I have tried putting the full path in the gulp file and tried using a config.json file to have all my settings in. The gulp file I started with did alot more and got this message so I tried to just copy directly from the modules home page to see if it was something I had in it stil same result.
This is interesting... Can you try to reproduce it without gulp? Is it possible that your dependency tree has multiple copies or maybe versions of node-sass?
Also, please check our TROUBLESHOOTING.md and post your node, npm versions and other information mentioned there.
Thank you for your time in looking into this!
My issue is how I was executing the gulp file. I was executing it from a mounted partition so the drive was not local to my machine it was an NFS share I had mounted.
So I SSH into the server and ran it localy and everything ran perfectly!
I figured this out by trying to run node-sass from the command line and even after assigning full permissions to everyone on the entire node_modules folder and trying to run it as root on my machine I was still getting permission denined.
So unless there is a way to run it over a mounted folder I will just run it from the server.
Thanks. This is a pretty interesting failure mode, will try to reproduce the problem.
I know this is closed but I have almost exactly the same error.
Setup: gulpfile.js
process.env.DISABLE_NOTIFIER = true;
var elixir = require('laravel-elixir');
require('laravel-elixir-vueify');
/*
|--------------------------------------------------------------------------
| Elixir Asset Management
|--------------------------------------------------------------------------
|
| Elixir provides a clean, fluent API for defining some basic Gulp tasks
| for your Laravel application. By default, we are compiling the Less
| file for our application, as well as publishing vendor resources.
|
*/
elixir(function(mix) {
mix.sass('app.scss');
mix.browserify('backend/app/app.js', 'public/js/backend/app.js');
});
package.json
{
"private": true,
"devDependencies": {
"babel-preset-react": "^6.5.0",
"babel-preset-stage-3": "^6.5.0",
"gulp": "^3.8.8",
"laravel-elixir": "*",
"laravel-elixir-vueify": "^1.0.3"
},
"dependencies": {
"babel-core": "^6.7.2",
"babel-plugin-transform-runtime": "^6.6.0",
"babel-preset-es2015": "^6.6.0",
"babel-runtime": "^5.8.35",
"vue-hot-reload-api": "^1.3.2",
"vue-mdl": "^0.4.0",
"vue-resource": "^0.7.0",
"vueify": "^8.3.6",
"vueify-insert-css": "^1.0.0"
}
}
Once I run gulp
[nik@machine simpleks-shop-l5]$ gulp
[14:03:14] Using gulpfile /run/media/nik/Media/Dev/Web/hilzweb/simpleks-shop-l5/gulpfile.js
[14:03:14] Starting 'default'...
[14:03:14] Starting 'sass'...
[14:03:14] 'sass' errored after 11 ms
[14:03:14] Error: /run/media/nik/Media/Dev/Web/hilzweb/simpleks-shop-l5/node_modules/node-sass/vendor/linux-x64-47/binding.node: failed to map segment from shared object
at Error (native)
at Object.Module._extensions..node (module.js:440:18)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (/run/media/nik/Media/Dev/Web/hilzweb/simpleks-shop-l5/node_modules/node-sass/lib/index.js:16:15)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
[14:03:14] Error in plugin 'run-sequence'
Message:
An error occured in task 'sass'.
[14:03:14] Finished 'default' after 17 ms
Once I run gulp without sass:
[nik@machine simpleks-shop-l5]$ gulp
[14:13:33] Using gulpfile /run/media/nik/Media/Dev/Web/hilzweb/simpleks-shop-l5/gulpfile.js
[14:13:33] Starting 'default'...
[14:13:33] Starting 'browserify'...
Fetching Browserify Source Files...
- resources/assets/js/backend/app/app.js
Saving To...
- public/js/backend/app.js
[14:13:34] Finished 'default' after 457 ms
[14:13:36] Finished 'browserify' after 2.46 s
As I read about what @staulien said concerning his mounted drive, I thought about my own setup. My development is on a second harddrive in my system!
When I move the project onto my home directory sass works just fine:
[nik@machine simpleks-shop-l5]$ gulp
[14:27:19] Using gulpfile ~/Downloads/simpleks-shop-l5/gulpfile.js
[14:27:19] Starting 'default'...
[14:27:19] Starting 'sass'...
Fetching Sass Source Files...
- resources/assets/sass/app.scss
Saving To...
- public/css/app.css
[14:27:20] Finished 'default' after 563 ms
[14:27:21] Finished 'sass' after 2.07 s
[14:27:21] Starting 'browserify'...
Fetching Browserify Source Files...
- resources/assets/js/backend/app/app.js
Saving To...
- public/js/backend/app.js
[14:27:23] Finished 'browserify' after 1.95 s
So it seems to not work on the second drive because it is not the one my linux system is installed on. To make this more clear, here is my /etc/fstab:
#
# /etc/fstab: static file system information
#
# <file system> <dir> <type> <options> <dump> <pass>
/dev/sda2 / ext4 rw,relatime,data=ordered 0 1
/dev/sdb1 /run/media/nik/Media ext4 defaults,noatime,user 0 2
/swapfile swap swap defaults 0 0
/dev/sda2 is where my linux system is installed and /dev/sdb1 where my Dev folder is (as you can also see from the code above).
I'm going to develop in my home directory for now, but maybe this is useful for debugging purposes. Setting up a second harddrive, or just as second partitoin, moving the project there and running gulp there should make this error reproduceable.
Huge thanks to @staulien for giving the hint - otherwise I would not be able to keep my development on!
Hello !
Just tried using node-sass on ArchLinux on an NTFS partition shared with my Windows and I got the same errors as above:
Loading "sass.js" tasks...ERROR
>> Error: /gandem/frontend/node_modules/node-sass/vendor/linux-x64-48/binding.node: failed to map segment from shared object
I moved project to home and it worked like a charm !
For what it's worth, I have just encountered this issue when I'd installed on an nfs mounted partition. Copying the same install files to local disk, npm rebuild and it was all ok.
Thank you. Shared library loading must work in order for the node binary modules to attach.
Hi! I'm encountering the same issue like @nobol has. Is there any solution to make it work on mounted partition? Thanks for any hints.
Not really, either change the file system type or the operating system
Change the file system? I've got the same fs on both partitions.
/dev/sda1 / ext4 rw,noatime,data=ordered,discard 0 1
/dev/sda2 /home/user1/Workspace ext4 rw,noatime,data=ordered,discard,users 0 2
The issue is exactly like nobol described it. I've tried to rebuild node-sass, tried to remove node_modules and reinstall all packages. No luck. When I move project folder to /dev/sda1 there's no problem.
Change the os? c'mon.. ;) Anyway. Thanks for quick answer. :) I'm gonna try to figure something out in a meantime and for now, I guess I have to work from /dev/sda1.
User mounted partitions, e.g. when using the ‘user’ or ‘users’ mount options in the /etc/fstab file, are done with the ‘noexec’ mount option by default for security reasons. Solution: Add the ‘exec’ mount option to the end of the mount options. It’s important that the option to be the last one, otherwise other mount option can over judge its effect.
That solved issue for me. Cheers!
@K4lin Thank you for digging into this! This is a very useful information that should end up in out TROUBLESHOOTING.md file.