Node-sass版本冲突

时间:2017-10-30 09:41:12

标签: node.js node-sass

我安装了node-sass 4.5.3,如下面的package.json文件内容所示

{
  "private": true,
  "scripts": {
    "prod": "gulp --production",
    "dev": "gulp watch"
  },
  "devDependencies": {
    "bootstrap-sass": "^3.3.7",
    "browserify-shim": "^3.8.14",
    "gulp": "^3.9.1",
    "jquery": "2.2.4",
    "laravel-elixir": "^6.0.0-11",
    "laravel-elixir-browserify-official": "^0.1.3",
    "laravel-elixir-vue-2": "^0.3.0",
    "laravel-elixir-vueify": "^2.0.0",
    "laravel-elixir-webpack-official": "^1.0.2",
    "node-sass": "^4.5.3",
    "vue": "^2.0.1",
    "vue-loader": "^13.3.0",
    "vue-resource": "^1.0.3",
    "vue-router": "^2.1.1",
    "vue-template-compiler": "^2.4.4"
  },
  "dependencies": {
    "alertifyjs": "^1.10.0",
    "chart.js": "^2.7.0",
    "codemirror": "^5.30.0",
    "croppie": "^2.5.0",
    "datatables.net": "^1.10.16",
    "datatables.net-bs": "^1.10.16",
    "datatables.net-buttons": "^1.4.2",
    "datatables.net-buttons-bs": "^1.4.2",
    "datatables.net-fixedheader": "^3.1.3",
    "datatables.net-fixedheader-bs": "^3.1.3",
    "eonasdan-bootstrap-datetimepicker": "^4.17.47",
    "font-awesome": "^4.7.0",
    "jquery-slimscroll": "^1.3.8",
    "laravel-echo": "^1.3.2",
    "malihu-custom-scrollbar-plugin": "^3.1.5",
    "moment": "^2.18.1",
    "pikaday": "^1.6.1",
    "pusher-js": "^4.2.1",
    "qtip2": "^3.0.3",
    "rangeslider.js": "^2.3.0",
    "select2": "^4.0.3",
    "selectric": "^1.11.1",
    "semantic-ui": "^2.2.11",
    "slick-carousel": "^1.8.1",
    "summernote": "^0.8.8",
    "toastr": "^2.1.2",
    "vue-loader": "^13.0.4",
    "wowjs": "^1.1.3"
  },
  "browser": {
    "vue": "vue/dist/vue.common.js"
  },
  "browserify": {
    "transform": [
      "browserify-shim"
    ]
  },
  "browserify-shim": {
    "./js/vendor/jquery.js": {
      "exports": "$"
    }
  }
}

但不知何故,当我运行npm install时,我最终得到了这个错误日志

gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/rengeranks/tce/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:125:13)
gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 2.6.32-673.26.1.lve1.4.30.el6.x86_64
gyp ERR! command "/home/rengeranks/.nvm/versions/node/v8.8.1/bin/node" "/home/rengeranks/tce/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/rengeranks/tce/node_modules/gulp-sass/node_modules/node-sass
gyp ERR! node -v v8.8.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
Build failed with error code: 1
npm WARN The package datatables.net is included as both a dev and production dependency.
npm WARN The package vue-loader is included as both a dev and production dependency.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@3.13.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-sass@3.13.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/rengeranks/.npm/_logs/2017-10-30T09_21_05_638Z-debug.log

我的node --versionv8.8.1,我的npm --version5.4.2。有人可以指出node-sass@3.13.1来自哪里,因为我相信这里的问题。提前谢谢。

P.S。我在共享主机上使用nvm安装了节点

1 个答案:

答案 0 :(得分:1)

laravel-elixir需要gulp-sass,而这又需要node-sass。你正在做的事情没有意义。你要么完全成熟Laravel Elixir,要么走个别模块。 gulp-sass package.json