2

I am trying to install Gulp globally on my computer but it is not happening. I am using Linux PopOs (Ubuntu, Debian).

I have done npm install -g gulp and the output is:

/home/ege/.npm/bin/gulp -> /home/ege/.npm/lib/node_modules/gulp/bin/gulp.js
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/gulp/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"a
ny"} (current: {"os":"linux","arch":"x64"})

+ gulp@4.0.2
updated 1 package in 14.336s

after this when I run gulp or gulp -v commands, I get:

Command 'gulp' not found, but can be installed with:       

sudo apt install gulp 

Then I installed Gulp with APT package manager: sudo apt install gulp Output:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libbonobo2-0 libbonobo2-common libbonoboui2-0
  libbonoboui2-common libglade2-0 libgnome-2-0
  libgnome-keyring-common libgnome-keyring0
  libgnome2-common libgnomecanvas2-0
  libgnomecanvas2-common libgnomeui-0 libgnomeui-common
  libgnomevfs2-0 libgnomevfs2-common liborbit-2-0
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  gulp
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/11.1 kB of archives.
After this operation, 46.1 kB of additional disk space will be used.
Selecting previously unselected package gulp.
(Reading database ... 257257 files and directories currently installed.)
Preparing to unpack .../archives/gulp_3.9.1-6_all.deb ...
Unpacking gulp (3.9.1-6) ...
Setting up gulp (3.9.1-6) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...

When I run gulp or gulp -v :

module.js:550
    throw err;
    ^

Error: Cannot find module 'gulp-util'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/usr/lib/nodejs/gulp/bin/gulp.js:4:13)
    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)

I can't understand what is happening. I know that gulp-util is deprecated and there is an article shows how to replace all the parts using gutil but I am not even using gulp, just trying to run the command and see it is there.

Other thing is, why does installing it via npm don't work?

Note: I have gulp-cli installed globally.

Besides everything, if I remove gulp that is installed via APT package manager and run npx gulp -v,I can see gulp is there...?!!??? Output:

[15:18:30] CLI version 3.9.1
[15:18:30] Local version 3.9.1

There are many open issues about similar problems but none of them was helpful for me. Please help..

dugong
  • 3,690
  • 4
  • 11
  • 27

1 Answers1

0

I found the solution after a while. It was about npm's prefix to define the directory where packages will be installed. Here is the related post and the answer.

dugong
  • 3,690
  • 4
  • 11
  • 27