Closed michalkolek closed 5 years ago
I solved it. Still don't know what caused it though.
Just went to C:\Users\<username>\AppData\Roaming\npm
and deleted everything inside that was related to gulp
.
Also deleted content of cache
folder in the same location.
And deleted package-lock.json
in the project folder.
From that I followed documentation:
npm install gulp-cli -g
npm install gulp -D
Now works fine.
These issues are always some sort of local environment configuration. I'm glad you got it figured out!
Does anyone know where i have to delete the files on a mac?
I use Node version manager. I thought I could just use $ npm list -g
to get the installed packages and where they are saved.
It gives me something like /Users/****/.nvm/versions/node/v10.16.0/lib
I went there and delete both gulp
and gulp-cli
directory.
Still when $ gulp -v
I get [18:21:44] CLI version 3.9.1
.
I thought maybe I had a global yarn install but using $ yarn list --pattern gulp
does get me:
yarn list v1.3.2
├─ gulp-cli@2.2.0
├─ gulp-exec@4.0.0
└─ gulplog@1.0.0
✨ Done in 0.88s.
So not the unwanted 3.9.1 (BTW: gulp 4 uses gulp-cli 2.2.0, why is there even a 3.9.1??? It is all so confusing).
Then when trying to uninstall all yarn related gulp stuff I run $ yarn global dir
.
But when going there the node_modules
folder does not include any gulp related stuff and the package.json
does not include any gulp packages either...
Where the hell is this gulp-cli 3.9.1. I am so clueless.
Thanks for any pointers!
I solved it by finding a stray gulp installation within /usr/local/lib/node_modules/gulp/bin/gulp.js
No idea why it was there.. 🤷♂
I'm 100% confused by this too. I also have CLI version 3.9.0
and seemingly no amount of un-installing things will remove it, thus Gulp 4 totally fails.
@chriscoyier I hope this helps. I was able to get my CLI version 3.9.0 to switch to 2.2.0. This worked for me, not 100% it will work in another environment, but I thought I would share. I spent way to many hours today searching this problem. [I recommend you keep all the files you delete below in case you need to put them back]
DELETE FOLDER: /usr/local/lib/node_modules/gulp/
(I originally deleted all the folders in node_modules
, but I think gulp
is the only one that needs to be deleted.)
DELETE FILE: /usr/local/bin/gulp
DELETE FOLDER: /Users/<username>/.npm
Additional folders you may need to delete
/Users/<username>/.cache
/Users/<username>/.npm-global
After that you'll need to install node/npm (I am using node v10.15.3 so I can use a gulp build local version 3.9 and local 4.0 concurrently), and run npm install --global gulp-cli
as directed on the gulp install page, I may have ran sudo npm install --global gulp-cli
But that is not recommended https://gulpjs.com/docs/en/getting-started/quick-start
@crisgaret After all that, and the final moment....
Aw snap. Same too-high version.
@crisgaret After all that, and the final moment....
Aw snap. Same too-high version.
Man, that sucks. I wish I knew more about the npm system to help you. I would just dig around in all the hidden usr/lib/bin folders I could find, and delete everything related to npm/gulp, also any .npm or .node type folders in your
We're not doing anything different here.
@chriscoyier Are your running /usr/local/bin/gulp
or something else? What is the output of command -v gulp
?
ip-192-168-1-169:~ chriscoyier$ command -v gulp
/usr/local/share/npm/bin/gulp
Looks like a weird location??
Thanks @terinjokes. Running command -v gulp
then deleting it from the resulting directory worked for me. This was sheer maddening.
It's one of the locations npm installed things to. Think it comes down to how node/npm was installed. You may also have multiple npm
binaries installed, and have gulp installed by different ones over time.
Ran into something in case someone has a similar issue. After following @terinjokes recommendation above, deleting the gulp directory, reinstalling the cli globally and then gulp in my project, I kept getting gulp: command not found
. Found this, added gulp
to my scripts in package.json
, then ran npm run gulp
and the magic happened. If upgrading from gulp 3 there will probably be some other issues but they will be much easier to deal with than this was.
I deleted the one at /usr/local/share/npm/bin/gulp
which I found via command -v gulp
and low and behold:
$ gulp -v
CLI version: 2.2.0
Thanks gang! Now to start the journey of actually writing stuff in Gulp 4!
@chriscoyier Happy you were able to get this sorted out! Huge shoutout to @terinjokes for the fix!
My problem was that gulp and gulp-cli were installed with sudo.
So I removed: /usr/lib/node_modules/gulp-cli /usr/lib/node_modules/gulp
And the used npm install in my project and everything worked fine.
Mac: where gulp
Ubuntu: whereis gulp
and remove the files shown in result.
for me, whereis gulp
:
gulp: /usr/bin/gulp /usr/share/man/man1/gulp.1.gz
then i run:
sudo rm /usr/bin/gulp /usr/share/man/man1/gulp.1.gz
and it's gone
gulp CLI version 3.9.1 diff with 2.2.0 on node v10.15
i meat the case:
use ./node_modules/.bin/gulp serve --max_old_space_size=8192 --branch="fxxx"
there will been error on CLI 3.9.1 : max_old_space_size and branch can not parse. but it works on gulp-cli 2.2.0
maybe what's why global gulp and gulp 4.0. use the cli 2.2.0
12:44 # ./node_modules/.bin/gulp serve --max_old_space_size=8192 --branch="fxxx" /root/.nvm/versions/node/v10.15.3/bin/node: bad option: --branch=fxxx [12:45:34] Node flags detected: --branch=fxxx [12:45:34] Respawned to PID: 15595
12:45 # ./node_modules/.bin/gulp -v [12:45:55] CLI version 3.9.1 [12:45:55] Local version 3.9.1
12:45 # gulp -v CLI version: 2.2.0 Local version: 3.9.1
12:18 # ./node_modules/gulp/bin/gulp.js -v CLI version: 2.2.0 Local version: 4.0.2
Was getting
gulpInst.start.apply(gulpInst, toRun);
so upon checking on here and SO I found out I needed to get rid of 3.9.1..Seems like I cant uninstall CLI version 3.9.1 that I presume is installed globally.
What I have tried is:
npm rm -g gulp-cli@3.9.1
npm rm -g gulp-cli
npm uninstall -g gulp-cli@3.9.1
npm rm -g gulp
npm uninstall -g gulp-cli
npm uninstall -g gulp
I tried above commands also for local (with
-D
flag) and made sure there was no gulp-cli folder in npm_modules.When I run
npm list gulp-cli
i get-- (empty)
When I rungulp -v
I still get[09:44:12] CLI version 3.9.1