Gulp - throw err cannot find module 'q'

I needed to configure Jekyll using Gulp, but when I started gulpit gave me the following error:

C:\Users\Admin\jekyll-gulp-sass-browser-sync-master>gulp
module.js:339
    throw err;
    ^

Error: Cannot find module 'q'
    at Function.Module._resolveFilename (module.js:337:15)
    at Function.Module._load (module.js:287:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (C:\Users\Admin\jekyll-gulp-sass-browser-sync-master\node_modules\browser-sync\node_modules\portscanner-plus\lib\index.js:3:9)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)

I tried to go to C:\Users\Admin\jekyll-gulp-sass-browser-sync-master\node_modules\gulp\node_modules\interpret\index.jsand made the following changes:

var q = require('q');

to

var q = require('q');

I ran npm install -g, but still nothing. Does anyone know why I am getting this?

+4
source share
1 answer

See the npm help topic for the installation command (by typing npm help installin your terminal).

Here is what you do:

  • npm install (in the package directory, without arguments):

    node_modules.         (.. -g --global, )         (        ) .         npm , .         --production ( NODE_ENV         ), npm ,        devDependencies.

:

  • npm install [@/] [--save | --save-dev | --save-optional]:

    @install, "". (        npm help 7 npm-config.)                , npm.

npm install -g, , . Cannot find module 'q' , q .

: npm install q, q- .

+9

Source: https://habr.com/ru/post/1613394/