gulp, command not found - Worked fine before, then suddenly stopped - node.js

A couple of months ago I was creating web apps with the MEAN stack on windows 10. Then I had a break and now I am trying to get back into it.
Back then I was using gulp, browsersync, webpack and nodemon to automate my server restarting-process and I remember everything working fine. But. when I tried this a week ago it just replied **"bash: gulp: command not found"
I uninstalled and reinstalled both gulp the other packages globally and locally, but no difference. I decided to try making an entirely new app and installing everything from scratch, but I got the same results. I have spent hours on this issue, but none of the solutions I can find online is working.
When I try to install gulp globally I get some warnings: (don't know if they have anything to do with it)
npm WARN deprecated minimatch#2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs#1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs#^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
Gulp is installed to this location:
C:\Users\<my username>\AppData\Roaming\npm\gulp -> C:\Users\<my username>\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js
Do anyone know how what might be my issue?
If there is any other information you need, please let me know. Thanks in advance!

Try to uninstall all global packages before installing the gulp globally. If you need remote packages in the future, remember them to install after.
Perhaps it also will help: https://demisx.github.io/gulp4/2015/01/15/install-gulp4.html
It shows how to completely uninstall the gulp and install it again.

Related

npm ERR! Maximum call stack size exceeded - Trying to install webpack

I have been on this for the past 24hrs, I am trying to install webpack via npm with this command.
$ npm install webpack webpack-cli --save-dev
and it has been a total disaster, I have tried lot of things people said online but nothing works at all.
I have tried to downgrade and upgrade my node and npm version but right now i am using the latest version.
I have also tried to run the npm cache clear --force and still nothing great happened.
Please if you know any fix, let me know or if you know any other way. Thanks
There is a folder called .nmprc, I can not remember where it is located on windows but you should delete the folder and you are good to go!

Stuck with Node and Bower

When I am giving npm install I am getting the below warning and it is not proceeding. It stuck in there.
npm WARN deprecated bower#1.8.0: ..psst! While Bower is maintained, we recommend Yarn and Webpack for *new* front-end projects! Yarn's advantage is security and reliability, and Webpack's is support for both CommonJS and AMD projects. Currently there's no migration path but we hope you'll help us figure out one.
Do anyone has any idea to proceed.
I waited for half an hour and it works ... the issue got resolved

Gulp installation: 'fs: re-evaluating native module sources is not supported' and node-sass errors

I have a new laptop and have had to reinstall gulp / npm in order to get my website files running properly locally. However I get the following error when I run the gulp command in Windows.
'fs: re-evaluating native module sources is not supported. If you
are using graceful-fs module please update it to a more recent
version'.
After looking into this error I have seen posts saying I simply need to run npm update -g npm. This command runs and flashes some info but then disappears before I can read the message. I assume it is already up to date seeing as though I have just installed it! I have tried running this command both globally and within the project folder.
If I run, npm info graceful-fs -v, my graceful-fs version is 3.10.8
So can anyone help? Im rubbish with this stuff :(
******UPDATE*******
I decided to uninstall graceful-fs and then run npm install.
After running gulp again I get,
Error the 'libsass' biding was not found in...
So I then ran npm rebuild node-sass and get load of node-sass errors.
Please help.
The issue seems to be that gulp 3.x (through vinyl-fs) uses the older version of graceful-fs. See this link for more info. I'm not sure but can you try updating gulp to 4.x ?

Google polymer starter kit WARN when npm install

When I download "Intermediate - Advanced users" version of polymer starter kit from github here and on the 4th step of these instructions here I always getting these WARNs:
$ sudo npm install
npm WARN deprecated gulp-minify-css#1.2.4: Please use gulp-clean-css
npm WARN deprecated graceful-fs#3.0.8: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs#^4.0.0 as soon as possible.
npm WARN engine launchpad#0.5.1: wanted: {"node":"^0.12"} (current: {"node":"4.4.2","npm":"2.15.0"})
npm WARN deprecated lodash#1.0.2: lodash#<3.0.0 is no longer maintained. Upgrade to lodash#^4.0.0.
npm WARN optional dep failed, continuing fsevents#1.0.11
npm WARN deprecated graceful-fs#1.2.3: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs#^4.0.0 as soon as possible.
npm WARN deprecated jade#0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
No matter what OS I'm using: tried both Ubuntu and Windows (git bash).
I have npm, bower, gulp installed globally but there's always those WARNs.
I think that maybe it's a dependencies problem or it's because of some code in some of polymer starter kit files, but I'm not a pro developer, so I can't find what is causing the problem
It's all seems to work though when I deploy the project, but I'm new to web dev and not sure if I have to just close my eyes on these WARNs
Nothing to worry about with those warnings. Those come from the npm packages that are set as dependencies in the package.json file. When you run npm install it will install all packages set in the package.json. Every single package has their own package.json that also has some dependenices. Each package install their own needed version of that package and sometimes they use older versions of those packages. Only way to get rid of those warnings would be to get the package creators to update their packages.
Only package that you can update yourself is the gulp-minify-css. You can uninstall that package npm remove gulp-minify-css --save-dev and install the newer non-deprecated version gulp-clean-css. npm install gulp-clean-css --save-dev. If you do that you need to update the gulpfile.js for the project to use the new package.
Find the styleTask for the starter-kit in the gulpfile.js:
var styleTask = function(stylesPath, srcs) {
return gulp.src(srcs.map(function(src) {
return path.join('app', stylesPath, src);
}))
.pipe($.changed(stylesPath, {extension: '.css'}))
.pipe($.autoprefixer(AUTOPREFIXER_BROWSERS))
.pipe(gulp.dest('.tmp/' + stylesPath))
.pipe($.minifyCss())
.pipe(gulp.dest(dist(stylesPath)))
.pipe($.size({title: stylesPath}));
};
and change the .pipe($.minifyCss()) row to be .pipe($.cleanCss({compatibility: 'ie10'}))
Now you have managed to update the starter-kit to use newer non-deprecated package.
Many packages in the npm package manager have some deprecated packages or cause other warnings while installing but most of the time there is no need to worry.
No need to worry about those warnings in this case. They shouldn't cause the problems that you allude to. I verified the PSK guide you mentioned (the page completely appears and functions without error in Chrome Version 49.0.2623.112 on OSX El Capitan).
npm displays deprecation warnings when a dependency being installed has been deprecated by the dependency's package owner/maintainer usually in favor of another package/version that has significant improvements. Packages can be deprecated/undeprecated at will and long after your app has been deployed.
For example, in January, you release an app that depends on gulp-minify-css#1.2.4. The owner of gulp-minify-css no longer has time to maintain the package, so he decides in March to deprecate it in favor of the actively maintained gulp-clean-css. Now, users who npm install your app (which also installs gulp-minify-css) see this deprecation warning, but your app still functions normally. The deprecation does not invalidate your app or cause errors.
While normally one might try to upgrade the dependencies to remove the warnings, that is not recommended for PSK due to package incompatibilities as recently discovered in a pull request:
So I just took this for a spin and I ran into some issues :( although
the current gulp plugins are deprecated they are working for the
community! This PR represents a "high risk" change, that we have found
to be breaking in several odd ways. For that reason I am going to
close this PR for now. That said let's revisit this PR in a few months
and see if things have stabilized more.

Unable to install Cordova with npm

Installing Cordova with Nodejs, i got this error :
npm WARN installMany normalize-package-data was bundled with npm#1.3.4, but bund
led package wasn't found in unpacked tree.
The error comes after the command npm install -g cordova
What can be the solution please ?
Thnx
I have solved this issue, so i present here what i did to solve it for anyone who may have the same problem :
I thought about reinstalling Nodejs. So i removed it and installed it again but nothing worked, then i took an installation directory of Nodejs in another computer (which works fine) and copied it to my computer and referenced it in the path environnement variable and every thing worked fine !!
The problem is with cordova and the version of the node.js. The latest version for Node.js (as of today for windows) is problematic with cordova. I went back a few versions and Node-v0-10-36-stable is working fine so far. Other versions may also work but I can only speak for v0.10.36.
http://blog.nodejs.org/2015/01/26/node-v0-10-36-stable/

Resources