Search code examples
node.jsgulpbootstrap-4ubuntu-16.04

Error: Cannot find module 'gulp-serve'


Ran the following commands...

sudo npm install --save-dev gulp-serve -globally

into the directory where gulpfile.js lives. Whenever I run sudo gulp, I receive the following error...

module.js:472
throw err;
^

Error: Cannot find module 'gulp-serve'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/var/www/html/bs4/gulpfile.js:2:14)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)

Solution

  • Remove node_modules then install it without sudo:

    npm i --save-dev gulp-serve