Ошибка запуска gulp

I’ve installed Gulp both globally and locally using

npm install gulp
npm install gulp -g
npm install gulp-util
npm install gulp-util -g

When try to run gulp I get

'gulp' is not recognized as an internal or external command, operable program, or batch file.

Running npm list gulp (or -g), I gulp@3.7.0 with the location of either my global or local gulp installation.

I’ve tried running node gulpfile.js pointed to my gulp file, and it runs without error, and of course, it starts with require('gulp').

Any suggestions on getting Gulp working on Windows(8.1)?

Community's user avatar

asked Jun 4, 2014 at 1:23

pedalpete's user avatar

9

You forgot to install the gulp-cli package:

npm install -g gulp-cli

Then you can run the command «gulp» from the command line.

answered Feb 7, 2016 at 21:23

csnate's user avatar

csnatecsnate

2,7691 gold badge13 silver badges4 bronze badges

5

The issue and answer can be found in this question: https://stackoverflow.com/a/9588052/1041104

The npm modules such as gulp are not installed to the path. Thus are not found when you run them in the CMD.

If gulp has been installed globally, you can use the process below:

  1. Create an environmental variable called NODE_PATH
  2. Set it to: %AppData%npmnode_modules or %AppData%npm on windows 8-10
  3. Close CMD, and Re-Open to get the new ENV variables

Add Node path to environmental variables

Running npm ls and npm ls -g shows that they are installed, but the CMD can not find them due to the missing link.

Community's user avatar

answered Jun 4, 2014 at 16:37

SteveLacy's user avatar

SteveLacySteveLacy

4,1202 gold badges22 silver badges30 bronze badges

11

  1. Be sure that you have gulp and gulp.cmd (use windows search)
  2. Copy the path of gulp.cmd (C:UsersXXXXAppDataRoamingnpm)
  3. Add this path to the Path envirement variable or edit PATH environment variable and add %APPDATA%npm
  4. Reopen cmd.

Add %APPDATA%npm to front of Path, not end of the Path.

H. Pauwelyn's user avatar

H. Pauwelyn

13.4k26 gold badges79 silver badges144 bronze badges

answered Dec 4, 2014 at 13:23

Habib Adıbelli's user avatar

3

  1. Install gulp globally.

    npm install -g gulp

  2. Install gulp locally in the project.

    npm install gulp

  3. Add below line in your package.json

    "scripts": {
    "gulp": "gulp"
    }

  4. Run gulp.

    npm run gulp

This worked for me.

ketan's user avatar

ketan

19k42 gold badges60 silver badges96 bronze badges

answered Sep 14, 2015 at 16:34

Gaurav Goel's user avatar

Gaurav GoelGaurav Goel

5714 silver badges2 bronze badges

4

I am using Windows 8.1. I had the same problem.

I installed gulp using Node.js command prompt

npm install -g gulp

Then go to the required directory in Node.js command prompt and try

gulp -v

If you get gulp local version not found exit the current Node.js command prompt and try the above command in a new Node.js command prompt

I tried the NODE_PATH mentioned by @SteveLacy but the command prompt was still not able to detect gulp command

answered Sep 9, 2014 at 17:47

Sudarsan GP's user avatar

Sudarsan GPSudarsan GP

1,19414 silver badges22 bronze badges

6

Had the same problem, not really best solution but install it globally:

npm install -g gulp

Of course it’s best to still have it in package.json, so you can do the following to install it locally and add an entry into package.json:

npm install --save-dev gulp

Everything else (gulp plugins) install also locally.

answered Sep 8, 2014 at 7:41

Namek's user avatar

NamekNamek

1,1821 gold badge13 silver badges28 bronze badges

0

The simple solution just do npm link gulp

answered Jun 18, 2017 at 10:34

miojamo's user avatar

miojamomiojamo

7252 gold badges14 silver badges31 bronze badges

2

I was having the same problem when trying to get gulp working on a co-workers VM. It seems the problem stems from the users folder.

Adding NODE_PATH in my environment variables didn’t fix the problem.

If you edit your ‘Path’ variable in your system variables and add ‘%APPDATA%npm’ at the end of that, it should fix the problem… Unless you or somebody else npm installed gulp as another user than the one you’re currently logged in as.

If you want it to be available for all users, put ‘C:UsersyourUserAppDataRoamingnpm'(or where ever you have gulp) explicitly instead of using ‘%APPDATA%npm’. You can also move the files to a more user-indifferent path.

Don’t forget to start a new cmd prompt, because the one you have open won’t get the new ‘Path’ variable automatically.

Now ‘gulp’.

answered May 14, 2015 at 19:46

Spaceman's user avatar

SpacemanSpaceman

1911 silver badge4 bronze badges

One right way:

  1. Cmd + R : type «%appdata%»
  2. Go to npm folder
  3. Copy whole path like «C:UsersBlah…npm»
  4. Go to My Computer + Right Click «Properties»
  5. Advanced System Settings (On the left)
  6. Click on Environment Variables
  7. Click on Edit Path
  8. Add that «C:UsersBlah…npm» to the end and type «;» after that
  9. Click ok and reopen cmd

Koert van Kleef's user avatar

answered Jul 13, 2015 at 23:37

yeralin's user avatar

yeralinyeralin

1,33713 silver badges24 bronze badges

3

You should first install gulp as global using:

npm install gulp -g

Otherwise the path solution will not resolve the problem.

Then add the npm modules path to the PATH using:

PATH = %PATH%;%APPDATA%npm

Jonathan Leffler's user avatar

answered Jan 1, 2017 at 23:31

Badr Bellaj's user avatar

Badr BellajBadr Bellaj

11.3k2 gold badges41 silver badges44 bronze badges

2

In my case it was that I had to install
gulp-cli by command npm -g install gulp-cli

answered Sep 17, 2018 at 10:14

Skylin R's user avatar

Skylin RSkylin R

2,0711 gold badge19 silver badges23 bronze badges

0

Try to add to your PATH variable the following:

C:UsersYOUR_USERAppDataRoamingnpm

I had the same problem and I solved adding the path to my node modules.

answered Dec 11, 2014 at 17:09

JC Gomez's user avatar

JC GomezJC Gomez

1011 silver badge2 bronze badges

I had a similar problem setting it up in windows 10. My answer is windows specific (look at the answers for modifying path in bash for a linux or OSX solution)

The core problem I had was that npm’s folder was not registered in the path.
I originally tried changing this in cmd prompt.

setx path "%path%;%appdata$npm"

Note that I used setx instead of set to ensure that the update to the environmental variable remains. Also note that it’s a backslash.

This should work but for me it didn’t because setx has a limit of only accepting 1024 characters… (yes it’s nonsensical to me as well).

So try the above and if you get a warning like did about reaching the 1024 limit, then you can do the other way I ended up doing.

First while youre still in the console, type: echo %appdata%npm … this is your npm folder that you want to add to the path so add it to your clipboard.

You have to go into the registry and reach the following folder:

HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerEnvironment

Then append the ‘Path’ value with the npm folder path in your clipboard. Reboot to activate the new value and you should now be good to go.

using regedit

Finally, just test it all out

>npm install -g gulp
>gulp

answered Apr 19, 2016 at 21:10

ThinkBonobo's user avatar

ThinkBonoboThinkBonobo

15.3k9 gold badges64 silver badges80 bronze badges

5

This ended up being a ‘user’ issue with me. I had installed npm and node on the system logged in as user1, then I set-up user2. I could run node, and I could run npm commnds, but could not run any npm packages from the command line.

I uninstalled node and npm, and reinstalled under the correct user in order to solve the problem. After that I can run packages from the command-line without issue.

answered Jul 1, 2014 at 3:25

pedalpete's user avatar

pedalpetepedalpete

21k45 gold badges128 silver badges238 bronze badges

1

The top answer did not work for me.

I am using a virtual machine that had a previous owner. The previous owner had an old version of npm installed. Using that, I was installed gulp globally with npm install -g gulp. Running the command gulp would return 'gulp' is not recognized as an internal or external command, operable program or batch file.. As I said, the top Answer did not fix my problem. I basically had to reinstall nodejs.

Solution

  1. Re-download nodejs
  2. npm install -g gulp
  3. gulp -version

This fixed the problem for me.

answered Jul 1, 2016 at 23:15

christo8989's user avatar

christo8989christo8989

6,3545 gold badges36 silver badges43 bronze badges

3

I had v0.12.3 of Nodejs on Win7 x64 and ran into similar issues when I tried installing gulp. This worked for me:

  1. Uninstalled Nodejs
  2. Installed Nodejs v0.10.29
  3. npm install -g npm
  4. npm install -g gulp

answered May 17, 2015 at 11:05

kmxr's user avatar

kmxrkmxr

4794 silver badges4 bronze badges

2

The NodeJS installer appears to add the user/AppData/Roaming/npm path to the user environment path, which is appropriate.

Normally, the PATH environment variable at the command line is the combination of the user environment path and the system environment path.

However, if the user environment path + the system environment path is larger than about 1920 characters, Windows does not not combine the user and system paths — only the system environment path is used.

See: https://stackoverflow.com/a/21270921/301152

So, when you open the Advanced System Settings in Windows to edit your environment variables, take a look to see if the user/AppData/Roaming/npm path is already in your user environment PATH. If it is, then the problem is that your user + system paths are too long, causing Windows to ignore your user path. Trim your user and/or system path strings and gulp should work as installed.

If you can’t find anything to trim away from your user and system paths, then add the user/AppData/Roaming/npm path to the system environment path and call it a hack.

Community's user avatar

answered Dec 2, 2015 at 0:48

dthorpe's user avatar

dthorpedthorpe

35.3k5 gold badges75 silver badges119 bronze badges

1

This works for me:

 npm link gulp
 npm update

Werner Kvalem Vesterås's user avatar

answered Jan 4, 2016 at 11:21

vineet's user avatar

vineetvineet

13.7k10 gold badges54 silver badges76 bronze badges

1

I was facing the same problem after installation. So i tried running cmd with elevated privileges (admin) and it worked.

Screen capture:

cmd

Rohit416's user avatar

Rohit416

3,3663 gold badges24 silver badges41 bronze badges

answered Jun 3, 2016 at 9:36

Amit Sharma's user avatar

3

Add this path in your Environment Variables PATH
C:UsersUSERNAMEAppDataRoamingnpm

answered Jul 19, 2016 at 13:49

Kranti123's user avatar

Kranti123Kranti123

1992 gold badges3 silver badges14 bronze badges

(Windows 10) I didn’t like the path answers. I use choco package manager for node.js. Gulp would not fire for me unless it was:

  1. Globally installed npm i -g gulp and local dir npm i --save-dev gulp

  2. The problem persisted beyond this once, which was fixed by completely removing node.js and reinstalling it.

I didn’t see any comments about local/global and node.js removal/reinstall.

answered Jun 2, 2018 at 15:32

This is most commonly because it is not found on environment variables as others have pointed out. This is what worked for me.

echo %PATH%

This will show you what’s one your PATH environment variable. If node_modules is not there there do the following to add it from your APPDATA path.

PATH = %PATH%; %APPDATA%npm

answered Aug 17, 2015 at 4:39

Illuminati's user avatar

IlluminatiIlluminati

4,5112 gold badges35 silver badges55 bronze badges

1

I resolved it by adding
C:Users[USER]AppDataRoamingnpm
to PATH
and not
C:Users[USER]AppDataRoamingnpmnode_modules

answered Oct 8, 2015 at 10:05

Marcos Cassiano's user avatar

1

I already had the one condition from this answer (I don’t know why)

https://stackoverflow.com/a/27295145/1175496

That is, my PATH already included %APPDATA%npm

In my case, the problem was npm was not installing modules there (again, I don’t know why)

Therefore I needed to do this:

$ npm config set prefix -g %APPDATA%/npm

After that, running
$ npm install -g gulp (or installing any other module) put the module in the place where PATH expects it.

Community's user avatar

answered Dec 22, 2015 at 22:59

Nate Anderson's user avatar

Nate AndersonNate Anderson

17.7k18 gold badges99 silver badges133 bronze badges

On my Windows 10 Enterprise, gulp was not installed in %AppData%, which is C:UsersusernameAppDatanpmnode_modules on my machine, but in C:UsersusernameAppDataLocalnpmnode_modules.

To get gulp to be picked up at the command prompt or in powershell, I added to the user PATH the value C:UsersusernameAppDataLocalnpm. After that it worked like a charm. Naturally I had to close the command prompt or powershell window and re-open for the above to take effect.

answered May 2, 2018 at 14:58

David Scarfo's user avatar

0

Had gulp command not found problem in windows 10 and Adding «%AppData%npmnode_modules» doesn’t work for me.
Do this steps please:

After doing

npm install -g npm

And

npm install -g gulp

Add

C:UsersYourUsernamenpm

to Path in System Variables.

It Works for me after all solutions failed me.

answered Aug 16, 2015 at 11:02

A. Najafi's user avatar

A. NajafiA. Najafi

1031 gold badge1 silver badge4 bronze badges

Run npm install gulp -g

if you are using windows, please add the gulp’s dir to PATH.

such like C:UsersYOURNAMEAppDataRoamingnpmnode_modulesgulp

Louis Barranqueiro's user avatar

answered Dec 21, 2015 at 12:54

user5523785's user avatar

In windows:

  1. Using your windows explorer, Navigate to your vagrant shared folder (I am using scotchbox by the way) e.g C:scotchbox/public/gulpProject
  2. In the address bar of the folder, type cmd and press Enter
  3. Do your gulp installation npm install

Tunaki's user avatar

Tunaki

132k46 gold badges331 silver badges418 bronze badges

answered Jan 4, 2016 at 8:51

Justis Matotoka's user avatar

In short:

You should add %NODE_PATH% to the system variable Path if the other answers don’t work.

The reason:

The point is, command prompt only executes programs under the Path system variable, not the user variables. If you have NODE_PATH set as a user variable, add %NODE_PATH% to Path.


I asked here and got marked duplicate for a question with different intention :(

NPM Windows doesn’t execute program under the User Variable path [duplicate]

Community's user avatar

answered Jan 22, 2016 at 14:02

Daniel Cheung's user avatar

Daniel CheungDaniel Cheung

4,7411 gold badge30 silver badges63 bronze badges

In Windows:

  1. Press the following two keys: Windows + r
  2. Type control /name microsoft.system into the run dialog box that appears from the previous step.

Windows run dialog box

  1. Select Advanced System Settings from the left of the window pane
  2. Click the Advanced tab on the system properties box that appears and click the Environment Variables button.
  3. Edit the PATH User environment variable.
  4. Click New on the edit environment variable window that pops up for the PATH variable and add the following: %APPDATA%npm to the start of the PATH environment variable (as shown in the image below).

Setting the environmental variable

  1. Close your Command Prompt and reopen it.

answered Jun 6, 2016 at 3:58

JSON C11's user avatar

JSON C11JSON C11

11.1k7 gold badges78 silver badges64 bronze badges

Добрый день. Подскажите, пожалуйста, скопировал из документации сайта https://www.browsersync.io SASS + CSS Injecting вот такой код:

var gulp        = require('gulp');
var browserSync = require('browser-sync').create();
var sass        = require('gulp-sass');

// Static Server + watching scss/html files
gulp.task('serve', ['sass'], function() {

    browserSync.init({
        server: "./app"
    });

    gulp.watch("app/scss/*.scss", ['sass']);
    gulp.watch("app/*.html").on('change', browserSync.reload);
});

// Compile sass into CSS & auto-inject into browsers
gulp.task('sass', function() {
    return gulp.src("app/scss/*.scss")
        .pipe(sass())
        .pipe(gulp.dest("app/css"))
        .pipe(browserSync.stream());
});

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

Конечно же, все папки прописал, под свои, но при запуске через командную строку выходит ошибка

PS C:UsersHomeDesktopproject> gulp

assert.js:350
    throw err;
    ^

AssertionError [ERR_ASSERTION]: Task function must be specified
    at Gulp.set [as _setTask] (C:UsersHomeDesktopprojectnode_modulesundertakerlibset-task.js:10:3)
    at Gulp.task (C:UsersHomeDesktopprojectnode_modulesundertakerlibtask.js:13:8)
    at Object.<anonymous> (C:UsersHomeDesktopprojectgulpfile.js:5:6)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)

После выполнения всех последовательных шагов в уроке 3.4. Планировщик задач Gulp после запуска команды gulp в терминале появляется 
gulp
[10:40:51] Using gulpfile ~DesktopУчебный 1Projekt Ubergulpfile.js
[10:40:51] Starting ‘default’…
[10:40:51] Starting ‘watch’…
[10:40:51] Starting ‘server’…
[10:40:51] Starting ‘styles’…
[10:40:51] Finished ‘styles’ after 127 ms
[Browsersync] Access URLs:
—————————————
Local: http://localhost:3000
External: http://192.168.31.219:3000
—————————————
UI: http://localhost:3001
UI External: http://localhost:3001
—————————————
[Browsersync] Serving files from: src  Далее запускается браузер в нем следующая ошибка Cannot GET в адресной строке http://localhost:3000. переустановка пакетов результата не дала та же ошибка. 

Package json 

{
  «name»: «scr»,
  «version»: «1.0.0»,
  «main»: «index.js»,
  «scripts»: {
    «test»: «echo «Error: no test specified» && exit 1″
  },
  «author»: «»,
  «license»: «ISC»,
  «devDependencies»: {
    «browser-sync»: «^2.26.7»,
    «gulp»: «^4.0.2»,
    «gulp-autoprefixer»: «^7.0.1»,
    «gulp-clean-css»: «^4.3.0»,
    «gulp-cli»: «^2.3.0»,
    «gulp-rename»: «^2.0.0»,
    «gulp-sass»: «^4.1.0»
  },
  «description»: «»
}

Файл  gulpfile.json скачан с репозитория 

const gulp        = require(‘gulp’);
const browserSync = require(‘browser-sync’);
const sass        = require(‘gulp-sass’);
const cleanCSS = require(‘gulp-clean-css’);
const autoprefixer = require(‘gulp-autoprefixer’);
const rename = require(«gulp-rename»);

gulp.task(‘server’, function() {

    browserSync({
        server: {
            baseDir: «src»
        }
    });

    gulp.watch(«src/*.html»).on(‘change’, browserSync.reload);
});

gulp.task(‘styles’, function() {
    return gulp.src(«src/sass/**/*.+(scss|sass)»)
        .pipe(sass({outputStyle: ‘compressed’}).on(‘error’, sass.logError))
        .pipe(rename({suffix: ‘.min’, prefix: »}))
        .pipe(autoprefixer())
        .pipe(cleanCSS({compatibility: ‘ie8’}))
        .pipe(gulp.dest(«src/css»))
        .pipe(browserSync.stream());
});

gulp.task(‘watch’, function() {
    gulp.watch(«src/sass/**/*.+(scss|sass)», gulp.parallel(‘styles’));
})

gulp.task(‘default’, gulp.parallel(‘watch’, ‘server’, ‘styles’));

В чем ошибка не могу понять поэтапно повторял несколько раз те же шаги результат один

при запуске команды gulp запускается браузер а там ошибка Cannot GET.

Помогите Пожайлуста кто может!

index.html лежит в папке src 

today I installed gulp with

npm -g install gulp
gulp -v 

and soon appear if I want open a gulp.js file with text editor or dreamweaver, tried on windows 8.1 and 7,

this is the gulpfile, gulpjs

var gulp= require('gulp');
var uglify = require('gulp-uglify');



gulp.task('compress', function() {
  gulp.src('lib/*.js')
    .pipe(uglify())
    .pipe(gulp.dest('dist'))
});

clear gulpfile all works well

thanks

asked Mar 17, 2015 at 10:37

LXG's user avatar

LXGLXG

1,9573 gold badges22 silver badges45 bronze badges

12

I delete nodejs and node plugins,

then I reinstall node, with bower and gulp globally, other plugin such as gulp-concat etc. use —save-dev this works for windows 8.1

thanks for all people comments

answered Mar 18, 2015 at 10:59

LXG's user avatar

LXGLXG

1,9573 gold badges22 silver badges45 bronze badges

@zinovyevaleks

При запуске Gulp выдаёт ошибку.

image

С тертьей версией работает нормально. Подскажите, куда копать?

@agragregra

Обновите пакеты, Gulp локальный и глобальный.

@zinovyevaleks

[13:05:24] CLI version 2.0.1
[13:05:24] Local version 4.0.0

Обновил. Запускается. Теперь стили не компилирует.

@abraus

[13:05:24] CLI version 2.0.1
[13:05:24] Local version 4.0.0

Обновил. Запускается. Теперь стили не компилирует.

А в терминале на что ругается?

@zinovyevaleks

[13:05:24] CLI version 2.0.1
[13:05:24] Local version 4.0.0
Обновил. Запускается. Теперь стили не компилирует.

А в терминале на что ругается?

Да ни на что не ругается. Просто запускает стартовую страницу без стилей.
image

image

@rusicsemenov

Так у Вас все работает, он сообщил ip и порты по которым работает сайт. Проверьте путь к css

@AndreyLevonyuk

Сначала нужно сформировать минифицированный CSS а для этого нужно запустить таск style.
После чего запускаете gulp.

@zinovyevaleks

Сначала нужно сформировать минифицированный CSS а для этого нужно запустить таск style.
После чего запускаете gulp.

Вот тут не понял. Таск есть в gulpfile, gulp при запуске должен собрать минифицированный файл стиля, он этого не делает. До обновления gulp до 4 версии всё работает.

@AndreyLevonyuk

Сначала нужно сформировать минифицированный CSS а для этого нужно запустить таск style.
После чего запускаете gulp.

Вот тут не понял. Таск есть в gulpfile, gulp при запуске должен собрать минифицированный файл стиля, он этого не делает. До обновления gulp до 4 версии всё работает.

У меня так же было, при запуске gulp тоже запустился проект без стилей. Посмотрел в папке app и увидел что отсутствует файл main.min.css. Просто запустил gulp style, после чего сформировался файл стилей ну и далее просто gulp. Компиляция SASS после этого нормально проходит.

@abraus

Вот тут не понял. Таск есть в gulpfile, gulp при запуске должен собрать минифицированный файл стиля, он этого не делает. До обновления gulp до 4 версии всё работает.

У меня так же было, при запуске gulp тоже запустился проект без стилей. Посмотрел в папке app и увидел что отсутствует файл main.min.css. Просто запустил gulp style, после чего сформировался файл стилей ну и далее просто gulp. Компиляция SASS после этого нормально проходит.

Обычно не нужно запускать таск стилей отдельно. Посмотрите внимательно в галп-файле, какой синтаксис используете и в каком стили пишете)

@AndreyLevonyuk

Хотя по идее должно работать просто запустив Gulp, так как таск styles выполняется первым…

@abraus

@abraus

Скорее всего или ошибка в стилях (точка с запятой к примеру в scss не проставлена) или синтаксис неверный. Хотя, если ошибка в стилях, консоль ругнуться должна. Но вроде было такое на памяти, что консоль молчала, а стили не компилились

@AndreyLevonyuk

Таки да)

Вот я тоже так сначала думал) не знаю почему но при распаковке архива, запуске npm i, затем gulp — в самый первый раз запускается без стилей. То есть при первом запуске почему-то таск styles не выполняется. Хотя синтаксис проверял изначально (использую SASS). Кстати при запуске во второй и последующие разы, отрабатывает нормально, даже если специально удалить файл main.min.css

@losthuman

Хотя по идее должно работать просто запустив Gulp, так как таск styles выполняется первым…

После запуска gulp выполняется watch, styles будет выполняться только если будут изменения в наблюдаемых файлах.

@abraus

Да, кстати, сейчас вот специально скачал, проверил. При первом запуске style.min.css не компилится. Как только вносишь изменения в scsssass сразу компилится))

@zinovyevaleks

Ну вот и разобрались. Продолжаем работать, спасибо!

@agragregra

@Nekspsy

Та же проблема и не получается решить, помогите, пожалуйста.

neks@DESKTOP-ERR8QEQ:/mnt/f/Work/GitHub/SM$ gulp
[17:34:00] Using gulpfile /mnt/f/Work/GitHub/SM/gulpfile.js
/usr/lib/node_modules/gulp/bin/gulp.js:129
    gulpInst.start.apply(gulpInst, toRun);
                   ^
TypeError: Cannot read property 'apply' of undefined
    at /usr/lib/node_modules/gulp/bin/gulp.js:129:20
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
    at Function.Module.runMain (module.js:695:11)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3

В проекте:

neks@DESKTOP-ERR8QEQ:/mnt/f/Work/GitHub/SM$ gulp -v
[17:34:41] CLI version 3.9.1
[17:34:41] Local version 4.0.0

Глобально:

C:WINDOWSsystem32>gulp -v
[17:37:04] CLI version 2.0.1

Вообще-то это актуально для всех паакетов, установленных через npm install.

У меня при установке на Ubuntu 14.04 через

sudo npm install g gulp

npm install savedev gulp

не работало ничего, связанное с gulp. Не вызывался даже

И самое неприятное, что при запуске любой команды, связанной с gulp, не пишется в консоль ничего, при этом неважно, что и как написать в файлах gulp.js, что локально, что в /usr/local/bin/gulp.

А проблема в том, что в /usr/local/bin/gulp первая строчка выглядит так:

а в Ubuntu устанавливается node-пакет под другим названием nodejs.

UPDATE Правильный фикс:

sudo aptget install nodejslegacy

Поэтому фиксится это так:

sudo npm install g gulp

npm install savedev gulp

sudo nano /usr/local/bin/gulp // или /usr/lib/node_modules/gulp/bin/gulp.js

и правим первую строчку на

Similar Posts

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
'use strict';
 
var gulp = require('gulp'),
    watch = require('gulp-watch'),
    plumber = require('gulp-plumber'),
    prefixer = require('gulp-autoprefixer'),
    sass = require('gulp-sass'),
    rigger = require('gulp-rigger'),
    rimraf = require('rimraf'),
    browserSync = require('browser-sync'),
    reload = browserSync.reload;
 
var path = {
    build: {
        html: '',
        style: 'css/'
    },
    src: {
        html: 'src/html/[^_]*.html',
        style: 'src/scss/*.scss'
    },
    watch: {
        html: 'src/html/**/*.html',
        style: 'src/scss/**/*.scss'
    }
};
 
var config = {
    server: {
        baseDir: './'
    },
    tunnel: true,
    host: 'localhost',
    port: 9000,
    logPrefix: 'Good!'
};
 
gulp.task('webserver', function () {
    browserSync(config);
});
 
gulp.task('clean', function (cb) {
    rimraf('./*.html', cb);
    rimraf('./css/', cb);
});
 
gulp.task('html:build', function () {
    gulp.src(path.src.html)
        .pipe(plumber())
        .pipe(rigger())
        .pipe(gulp.dest(path.build.html))
        .pipe(reload({stream: true}));
});
 
gulp.task('style:build', function () {
    gulp.src(path.src.style)
        .pipe(plumber())
        .pipe(sass())
        .pipe(prefixer({
            browsers: ['last 2 versions'],
            cascade: false
        }))
        .pipe(gulp.dest(path.build.style))
        .pipe(reload({stream: true}));
});
 
gulp.task('build', [
    'html:build',
    'style:build'
]);
 
 
gulp.task('watch', function(){
    watch([path.watch.html], function(event, cb) {
        gulp.start('html:build');
    });
    watch([path.watch.style], function(event, cb) {
        gulp.start('style:build');
    });
});
 
 
gulp.task('default', ['build', 'webserver', 'watch']);

Понравилась статья? Поделить с друзьями:
  • Ошибка запуска gta 5 epic games
  • Ошибка запуска google chrome
  • Ошибка запуска genshin impact
  • Ошибка запуска geforce experience something went wrong
  • Ошибка запуска fortnite ls 0016