Задать вопрос
@sidorchik

Почему не устанавливается плагин Sass для Gulp?

Создал проект, подключил Gulp, ввёл команду для добавления плагина Sass, но вылезли ошибки. Подскажите, пожалуйста, что сделать, чтобы плагин добавился.

MacBook-Pro-Ilya:pigna ilyasidorchik$ sudo npm install node-sass gulp-sass --save-dev
Password:

> node-sass@4.11.0 install /Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/node-sass
> node scripts/install.js

Unable to save binary /Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/node-sass/vendor/darwin-x64-57 : { Error: EACCES: permission denied, mkdir '/Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/node-sass/vendor'
    at Object.fs.mkdirSync (fs.js:885:18)
    at sync (/Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/mkdirp/index.js:71:13)
    at Function.sync (/Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/mkdirp/index.js:77:24)
    at checkAndDownloadBinary (/Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/node-sass/scripts/install.js:114:11)
    at Object.<anonymous> (/Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/node-sass/scripts/install.js:157:1)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
  errno: -13,
  code: 'EACCES',
  syscall: 'mkdir',
  path: '/Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/node-sass/vendor' }

> node-sass@4.11.0 postinstall /Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/node-sass
> node scripts/build.js

Building: /usr/local/bin/node /Users/ilyasidorchik/PhpstormProjects/pigna/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   '/Users/ilyasidorchik/PhpstormProjects/pigna/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@8.12.0 | darwin | 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` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (/Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/which/which.js:89:16
gyp verb `which` failed     at /Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb `which` failed  python2 { Error: not found: python2
gyp verb `which` failed     at getNotFoundError (/Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/which/which.js:89:16
gyp verb `which` failed     at /Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb `which` failed   stack: 'Error: not found: python2\n    at getNotFoundError (/Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/which/which.js:13:12)\n    at F (/Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/which/which.js:68:19)\n    at E (/Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/which/which.js:80:29)\n    at /Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/which/which.js:89:16\n    at /Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/isexe/index.js:42:5\n    at /Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/isexe/mode.js:8:5\n    at FSReqWrap.oncomplete (fs.js:152:21)',
gyp verb `which` failed   code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python /usr/bin/python
gyp verb check python version `/usr/bin/python -c "import sys; print "2.7.10
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: 8.12.0
gyp verb command install [ '8.12.0' ]
gyp verb install input version string "8.12.0"
gyp verb install installing version: 8.12.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: 8.12.0
gyp verb build dir attempting to create "build" dir: /Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/node-sass/build
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/node-sass/build'
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/usr/local/bin/node" "/Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/node-sass
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
Build failed with error code: 1
npm WARN pigna@1.0.0 No description
npm WARN pigna@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.11.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-sass@4.11.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!     /Users/ilyasidorchik/.npm/_logs/2018-12-11T19_27_30_193Z-debug.log
  • Вопрос задан
  • 2420 просмотров
Подписаться 1 Простой 3 комментария
Решения вопроса 1
bingo347
@bingo347
Crazy on performance...
Если внимательно почитать вывод в консоль, то можно увидеть, что проблема с правами, а все дело в том, что не нужно запускать npm install из под sudo

итак, для начала следует из под рута снести папку модуля:
sudo rm -rf /Users/ilyasidorchik/PhpstormProjects/pigna/node_modules/node-sass

затем еще раз выполнить npm install node-sass gulp-sass --save-dev только на этот раз без sudo
Ответ написан
Пригласить эксперта
Ответы на вопрос 1
ZZZ1234
@ZZZ1234
Front-End
в командную строку вводите

npm install gulp-sass --save-dev

затем
var gulp = require('gulp');
var sass = require('gulp-sass');

gulp.task('sass', function () {
return gulp.src (['sass/**/*.sass', 'sass/**/*.scss'])
.pipe(sass({outputStyle: 'expanded'}).on('error',sass.logError))
.pipe(gulp.dest('css'))
});

gulp.task('watch', function () {
gulp.watch(['sass/**/*.sass', 'sass/**/*.scss'],['sass']);
});

gulp.task ('default', ['watch']);

ищите нужный путь вот здесь gulp.watch(['sass/**/*.sass', 'sass/**/*.scss'],['sass']);

затем запускаете gulp в командную строку
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы