0
votes

I get the following error when I try to start a server with the webpack command "npm run dev":

ERROR in ./~/css-loader!./~/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-9ff273a2","scoped":false,"hasInlineConfig":false}!./~/sass-loader/lib/loader.js!./~/vue-loader/lib/selector.js?type=styles&index=0!./src/App.vue
Module build failed: Error: /var/www/html/my_project_name/node_modules/node-sass/vendor/linux-x64-48/binding.node: failed to map segment from shared object: Operation not permitted
    at Error (native)
    at Object.Module._extensions..node (module.js:597:18)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at module.exports (/var/www/html/my_project_name/node_modules/node-sass/lib/binding.js:19:10)
    at Object.<anonymous> (/var/www/html/my_project_name/node_modules/node-sass/lib/index.js:14:35)
    at Module._compile (module.js:570:32)
 @ ./~/vue-style-loader!./~/css-loader!./~/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-9ff273a2","scoped":false,"hasInlineConfig":false}!./~/sass-loader/lib/loader.js!./~/vue-loader/lib/selector.js?type=styles&index=0!./src/App.vue 4:14-317 13:3-17:5 14:22-325
 @ ./src/App.vue
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://0.0.0.0:8080 webpack/hot/dev-server ./src/main.js

My environment:

  • Centos7 via VirtualBox (installed on Windows7) with a mounted folder
  • Node version: 6.10.3
  • Npm version : 3.10.10
  • I'm behind a corporate proxy

What I did:

I installed vue-cli:

sudo npm install -g vue-cli --no-bin-links

I created a new vue-cli project with the "use sass" option:

vue init webpack-simple my_project_name

I installed dependencies:

cd my_project_name
sudo npm install --no-bin-links

In "package.json" file, I replaced:

"dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot"

With:

"dev": "cross-env NODE_ENV=development webpack-dev-server --hot --port 8080 --host 0.0.0.0"

In "node_modules/webpack-dev-server/lib/Server.js" file, I added:

options.watchOptions = {
    aggregateTimeout: 300,
    poll: true
};

I uninstalled sass, then I installed sass again:

npm uninstall node-sass --save-dev
sudo npm install node-sass --save-dev --no-bin-links

Now, I try to start the server:

npm run dev

And I get the following error:

ERROR in ./~/css-loader!./~/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-9ff273a2","scoped":false,"hasInlineConfig":false}!./~/sass-loader/lib/loader.js!./~/vue-loader/lib/selector.js?type=styles&index=0!./src/App.vue
    Module build failed: Error: /var/www/html/my_project_name/node_modules/node-sass/vendor/linux-x64-48/binding.node: failed to map segment from shared object: Operation not permitted
        at Error (native)
        at Object.Module._extensions..node (module.js:597:18)
        at Module.load (module.js:487:32)
        at tryModuleLoad (module.js:446:12)
        at Function.Module._load (module.js:438:3)
        at Module.require (module.js:497:17)
        at require (internal/module.js:20:19)
        at module.exports (/var/www/html/my_project_name/node_modules/node-sass/lib/binding.js:19:10)
        at Object.<anonymous> (/var/www/html/my_project_name/node_modules/node-sass/lib/index.js:14:35)
        at Module._compile (module.js:570:32)
     @ ./~/vue-style-loader!./~/css-loader!./~/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-9ff273a2","scoped":false,"hasInlineConfig":false}!./~/sass-loader/lib/loader.js!./~/vue-loader/lib/selector.js?type=styles&index=0!./src/App.vue 4:14-317 13:3-17:5 14:22-325
     @ ./src/App.vue
     @ ./src/main.js
     @ multi (webpack)-dev-server/client?http://0.0.0.0:8080 webpack/hot/dev-server ./src/main.js

For information, everything works fine if I don't activate the "sass" option when I create the project with "vue init".

Does anyone know how to fix it please?

1

1 Answers

2
votes

I found a solution.

In my "/etc/fstab" file, I mounted my folder with these parameters:

users,rw,credentials=/root/.creds,file_mode=0777,dir_mode=0777,uid=1000,gid=100 0 0

I changed these parameters, like this:

rw,credentials=/root/.creds,file_mode=0777,dir_mode=0777,uid=1000,gid=100,exec 0 0

And everything works fine now!