webpack / vue-cli / sass 错误:"failed to map segment from shared object: Operation not permitted"

Error with webpack / vue-cli / sass: "failed to map segment from shared object: Operation not permitted"

当我尝试使用 webpack 命令启动服务器时出现以下错误 "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

我的环境:

我做了什么:

我安装了vue-cli:

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

我使用 "use sass" 选项创建了一个新的 vue-cli 项目:

vue init webpack-simple my_project_name

我安装了依赖项:

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

在"package.json"文件中,我替换了:

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

有:

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

在"node_modules/webpack-dev-server/lib/Server.js"文件中,我添加了:

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

我卸载了sass,然后我又安装了sass:

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

现在,我尝试启动服务器:

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

有关信息,如果我在使用 "vue init" 创建项目时不激活 "sass" 选项,一切正常。

请问有人知道怎么解决吗?

我找到了解决办法。

在我的“/etc/fstab”文件中,我使用这些参数安装了我的文件夹:

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

我更改了这些参数,如下所示:

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

现在一切正常!