Собираю сайт в галпе и столкнулся с проблемой:
На работе стоит ubuntu, дома десятка.
Для выполнения тасков и обработки некоторых sass файлов, требуется
gulp-sass node-sass
, но на рабочем компе он не ставится
вообще и при запуске любых тасков выдает ошибку.
Error: Cannot find module 'node-sass'
и / или
Error: Cannot find module 'gulp-sass'
Т.е. рабочий процесс не возможен.
Айтишники тоже не могут решить проблему. Глобальное удаление / изменение / обновление не помогают.
Но при этом, я установил их на домашнем ноуте и работаю дома нормально.
В итоге, у меня получается два таска, для дома и работы: один делает все через gulp-sass (дом), а в другой обрабатывает выбранные (мною) скомпилированные css файлы (костыли для работы).
Суть вопроса:
Можно ли как-то обойти эту ошибку и как бы отключить установленный дома
gulp-sass
Комментирование переменной
const sass = require('gulp-sass');
и тасков не помогает.
Раньше на убунте работал руби-сасс, но это тоже такое себе решение...
лог при установке
npm install node-sass gulp-sass --save-dev
> node-sass@4.12.0 install ~/node_modules/node-sass
> node scripts/install.js
Cached binary found at ~/.npm/node-sass/4.12.0/linux-x64-64_binding.node
> gifsicle@4.0.1 postinstall ~/node_modules/gifsicle
> node lib/install.js
⚠ spawn ~/node_modules/gifsicle/vendor/gifsicle EACCES
⚠ gifsicle pre-build test failed
ℹ compiling from source
✖ Error: Command failed: /bin/sh -c autoreconf -ivf
/bin/sh: 1: autoreconf: not found
at Promise.all.then.arr (~/node_modules/execa/index.js:231:11)
at process._tickCallback (internal/process/next_tick.js:68:7)
> node-sass@4.12.0 postinstall ~/node_modules/node-sass
> node scripts/build.js
Binary found at ~/node_modules/node-sass/vendor/linux-x64-64/binding.node
Testing binary
Binary has a problem: Error: ~/node_modules/node-sass/vendor/linux-x64-64/binding.node: failed to map segment from shared object
at Object.Module._extensions..node (internal/modules/cjs/loader.js:805:18)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at module.exports (~/node_modules/node-sass/lib/binding.js:19:10)
at Object. (~/node_modules/node-sass/lib/index.js:14:35)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
Building the binary locally
Building: /usr/local/bin/node ~/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ '/usr/local/bin/node',
gyp verb cli '~/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli 'rebuild',
gyp verb cli '--verbose',
gyp verb cli '--libsass_ext=',
gyp verb cli '--libsass_cflags=',
gyp verb cli '--libsass_ldflags=',
gyp verb cli '--libsass_library=' ]
gyp info using node-gyp@3.8.0
gyp info using node@10.16.0 | linux | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` succeeded python2 /usr/bin/python2
gyp verb check python version `/usr/bin/python2 -c "import sys; print "2.7.12
gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
gyp verb get node dir no --target version specified, falling back to host node version: 10.16.0
gyp verb command install [ '10.16.0' ]
gyp verb install input version string "10.16.0"
gyp verb install installing version: 10.16.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 10.16.0
gyp verb build dir attempting to create "build" dir: ~/node_modules/node-sass/build
gyp verb build dir "build" dir needed to be created? ~/node_modules/node-sass/build
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: ~/node_modules/node-sass/build/config.gypi
gyp verb config.gypi checking for gypi file: ~/node_modules/node-sass/config.gypi
gyp verb common.gypi checking for gypi file: ~/node_modules/node-sass/common.gypi
gyp verb gyp gyp format was not specified; forcing "make"
gyp info spawn /usr/bin/python2
gyp info spawn args [ '~/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '~/node_modules/node-sass/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '~/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '~/.node-gyp/10.16.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=~/.node-gyp/10.16.0',
gyp info spawn args '-Dnode_gyp_dir=~/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=~/.node-gyp/10.16.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=~/node_modules/node-sass',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.' ]
gyp verb command build []
gyp verb build type Release
gyp verb architecture x64
gyp verb node dev dir ~/.node-gyp/10.16.0
gyp verb `which` succeeded for `make` /usr/bin/make
gyp info spawn make
gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
make: вход в каталог «~/node_modules/node-sass/build»
g++ '-DNODE_GYP_MODULE_NAME=libsass' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DLIBSASS_VERSION="3.5.4"' -I~/.node-gyp/10.16.0/include/node -I~/.node-gyp/10.16.0/src -I~/.node-gyp/10.16.0/deps/openssl/config -I~/.node-gyp/10.16.0/deps/openssl/openssl/include -I~/.node-gyp/10.16.0/deps/uv/include -I~/.node-gyp/10.16.0/deps/zlib -I~/.node-gyp/10.16.0/deps/v8/include -I../src/libsass/include -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -std=gnu++1y -std=c++0x -fexceptions -frtti -MMD -MF ./Release/.deps/Release/obj.target/libsass/src/libsass/src/ast.o.d.raw -c -o Release/obj.target/libsass/src/libsass/src/ast.o ../src/libsass/src/ast.cpp
make: g++: Команда не найдена
src/libsass.target.mk:150: ошибка выполнения рецепта для цели «Release/obj.target/libsass/src/libsass/src/ast.o»
make: *** [Release/obj.target/libsass/src/libsass/src/ast.o] Ошибка 127
make: выход из каталога «~/node_modules/node-sass/build»
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (~/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:198:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 4.4.0-78-generic
gyp ERR! command "/usr/local/bin/node" "~/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd ~/node_modules/node-sass
gyp ERR! node -v v10.16.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: gifsicle@4.0.1 (node_modules/gifsicle):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: gifsicle@4.0.1 postinstall: `node lib/install.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.12.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.12.0 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! ~/.npm/_logs/2019-09-11T13_56_53_776Z-debug.log