different versions of gulp-cli
Hello everyone, I might be a young and inexperienced programmer, but I've encountered a strange problem that I can't solve.
I'm using Ubuntu 22.04 and PHPStorm 2024.1.1.
To make my work easier, I decided to use Gulp in my projects. The problem is that when I enter the command gulp -v
in the system terminal,
I get this result:
CLI version: 3.0.0
Local version: 5.0.0
However, when I enter the same command in the IDE, I get a different result:
CLI version: 2.0.1
Local version: 5.0.0
When I try to run the gulp
command in the IDE terminal, I receive an "Unsupported gulp version" error. However, when I execute the gulp
command in the Ubuntu terminal, the gulp tasks are performed correctly. Could anyone help me figure out what I did wrong or what I didn't do? Lastly, I should mention that uninstalling and reinstalling gulp-cli does not resolve the issue.
Please sign in to leave a comment.
Where did you run this command, in the PhpStorm terminal? What shell do you have selected in File | Settings | Tools | Terminal, what do your settings there look like? What is a result of running
which gulp
in the system terminal and the IDE built-in terminal?Thank you for your answer.
Here is a screenshot of the settings:
And this is the output of which gulp in the system terminal
/usr/local/bin/gulp
And this is the output from the PHPStorm terminal
/usr/bin/gulp
What shell do you use as your system terminal? What is a result of running
echo $PATH
in both OS and built-in terminals?system terminal:
/home/konik/gems/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/konik/.local/share/JetBrains/Toolbox/scripts:/home/konik/.npm-packages/bin:/usr/bin:/usr/local/bin/
PHPStorm terminal:
/usr/bin:/home/konik/gems/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/konik/.local/share/JetBrains/Toolbox/scripts:/home/konik/NASfirma/PHPprojekty/joomlaModule/imageMap/node_modules/.bin:/home/konik/.npm-packages/bin:/usr/bin:/usr/local/bin/
echo $0
bash
Could you check if disabling Add node-modules/.bin from project root to path makes any difference?
If it doesn't, please share the idea.log (Help> Show Log in …).
The "Add node-modules/.bin from project root to path" setting doesn't make any difference.
However, I discovered something more interesting and realized that I have quite a mess. What's worse is that I don't know how to resolve it. I decided to uninstall all of Node.js, to be precise, to clean it completely.
I reinstalled it using APT, but Ubuntu's repositories have an old version of Node.js. So, I uninstalled it and followed the instructions on the Node.js website.
It turns out that after installing Node v20 and NPM v10 and entering the command gulp -v, it shows me CLI version 2.0.1.
At this point, I was perplexed because I didn't install Gulp after cleaning Node. Even when creating a completely new project, I get the same result when executing the command gulp -v.
So, I attempted to uninstall Node again and this time installed it via Snap. It turns out that without installing Gulp, I get information that gulp-cli is installed. What's going on? I really don't understand what I've messed up.
What's more interesting is that using the command npm uninstall -g gulp-cli doesn't allow me to uninstall it, even with the sudo command.
I suspect that the problem doesn't lie in the IDE itself, but in my system.
If anyone is able to help, I would greatly appreciate it because my knowledge is insufficient to solve this problem.
You have the old version of gulp installed globally in
/usr/bin/gulp
. Un-installing/re-installing Node won't help, you have to remove the old Gulp installation somehow. Ifnpm uninstall -g gulp-cli
doesn't work, try removing it manually.Configure PHPStorm to Use the Correct Node and npm
Ensure PHPStorm is using the same Node.js and npm as your system terminal.
Open PHPStorm Settings:
Navigate to Node.js and npm:
Set the Node interpreter:
Setting up the Node.js interpreter in the IDE preferences won't help with the
$PATH
issue.The problem is solved. Special thanks to Elena Pogorelova. Your suggestion to manually remove
/usr/bin/gulp
helped to resolve everything related to gulp in this location and others where gulp was present.After manually removing everything related to Gulp, I cleaned up nodejs just to be sure. After that, I restarted the computer and reinstalled nodejs. I then ran the command gulp -v and received a message to install gulp. Of course, I followed the instruction and installed gulp-cli globally.
Only after these steps did I open PHPStorm without changing its configuration. I executed the command
gulp -v
, and I saw the correct versions of gulp-cli and gulp.All that was left was to run the gulp command, and I was pleased to see an error that I understand because it resulted from my mistake in the gulpfile.js file.
In summary, in previous years I must have messed up quite a bit, simply due to "lack of experience and understanding of the subject." Now I have cleaned up the system, and everything is back to normal.
Once again, thanks to everyone for the help.