All of sudden gulp command not recognizing in spfx solution - npm

Solution type: SharePoint SPFx
I made windows update on this Sunday. From that point, I am not able to execute gulp commands. I am not sure if there is any relation between windows update and gulp command. I am getting below error.
I have installed gulp again by npm install gulp -g. I have restarted my machine and tried. But still same issue. I have added this in environment variables also.
I have followed all the instructions explained in this issue but no resolution found.
After installation of gulp globally when I run below command it is not list me gulp

You are checking the local packages, but you should check the global:
npm list -g --depth=0

Related

Yarn Type Error: "Invalid Number of Spaces"

I have a work project that is configured using yarn. I've used npm commands on other projects for the company, but for this project, I need to use yarn. The reason that I haven't used yarn before is because whenever I run any yarn commands locally, I get the following error:
TypeError: Invalid number of spaces
at tokenise (/usr/local/lib/node_modules/yarn/lib/cli.js:63358:17)
at tokenise.next (<anonymous>)
I'm on a mac and have tried running yarn, brew install yarn,npm install --global yarn and curl --compressed -o- -L https://yarnpkg.com/install.sh | bash. I've also tried npm uninstall yarnand brew uninstall yarn to try to start fresh, but after each attempt at removing and reinstalling, I get the same error.
The cloned repository that I'm working with includes a .yarnrc file and a yarn.lock file. Also, I'm on a work vpn, and have to install dependencies over the vpn, so I have a mirror registry in my .yarnrc file.
Any suggestions on where to start troubleshooting? Obviously, I'm doing something wrong here.

Gulp install on Windows (Npm issue)

I'm trying to install Gulp for my Angular UI project and I'm a bit surprised by the fact that it won't install due to it's dependencies. So, node installed fine, but npm.js refuses to install due to file path too long error. My folder structure is 75 characters long, of the 260 available characters, that leaves 185 characters for npm to use. Am I missing something here, or do the npm authors expect me to fire up a linux box for my UI? (A deal breaker)
Update:
What is the best way to install gulp as a dependency for my Angular UI project? (My goal is to ultimately have gulp become part of my TFS CI)
Ignoring your path length problem for now (you may want to split your question), as far as how to get gulp installed, you just need to include it in your package.json file as a dependency.
You can do that by running npm install --save gulp
However, that does need npm installed first.
The easiest way to do this is to download and install Node from:
https://nodejs.org/en/download/
This will install Node and npm globally, which should avoid your path length problem and in my experience is the standard approach (I've not worked with TFS, but all other CI pipelines I've worked with support Node via a container image or build option/step).
If you dont want to manually install Node, you can use something like Chocolatey to install it automatically (you can install Chocolatey from https://chocolatey.org/ and then you can run choco install nodejs from your command line).

"Node Commands" printed at prompt when trying to run grunt/ gulp on Windows 7

I've installed nodejs, and have used npm to install grunt using
npm install grunt
When I try to run grunt, I am presented with what appears to be instructions on running node commands: (see image)
the same applies when trying to run gulp
I have done the same steps on other computers, and had no problem running grunt previously
Please suggest ideas as to what's going on.
Thanks
As suggested by Joe Clay, the problem was that there was another app called node.exe whose pathwas in PATH variable before nodejs.
see also:
Nodejs seems to be not working; npm do work, however

Command invalid: run always ask to create a project

I have a project about 4 months and suddenly the aurelia's CLI commands are not working.
When I try to execute au run --watch I receive a message with options to create a new project under the path.
I have already tried to uninstall and reinstall the aurelia CLI, It's not work.
The last thing I have done was to execute a git clean -xdf
I think that could be something on my project. Someone could help me?
ANSWER
After some attempts I fixed the problem:
1) I reinstall Git and Node;
2) I have deleted all the files under the \AppData\Roaming\npm-cache path;
3) I have checked if the Git and Node were in the PATH of environment variables;
4) I run the npm install command;
Is aurelia-cli included in the devDependencies of the project and also installed globally?
First, install globally:
npm i -g aurelia-cli
Then, in the project directory, install & save to devDependencies:
npm i --save-dev aurelia-cli
You should then be able to run au in the project directory and see that the build and run commands are now available.
Note that you'll also need to install the necessary gulp dependencies required by the tasks in your project devDependencies.
EDIT: See aurelia/cli/issues/485 which confirms that installing aurelia-cli as a local dependency fixes this issue.

gulp installation global vs. local as dev dependency

From the instructions page of gulp, it's asked to install it globally as well as in the project as dev dependency.
My question is why do we need to install it twice? Why can't the project one use the global one?
and I do get this error prompting to install it locally and I've followed this tutorial as well but still stuck. http://blog.webbb.be/command-not-found-node-npm/
[11:47:51] Local gulp not found in ~/Documents/project
[11:47:51] Try running: npm install gulp
Link-> https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md
The error means you didn't install gulp locally. This means you have to add it to your dependencies in package.json (or just call npm i gulp --save).
It needs to be installed locally because gulpfile.js typically runs some code related to gulp. That's why it calls var gulp = require('gulp'); at the top of your gulpfile.js. This call loads gulp from your package node_modules. That's also where functions like gulp.task or gulp.src come from.
At the same you want to easily use gulp in CLI, that's why it needs to be installed also globally so you can run it by just:
$ gulp
Btw, you can also run just your local gulp:
Insert to your package.json:
"scripts": {
"gulp": "gulp",
}
This tells npm that by executing gulp command we want to run script ./node_modules/.bin/gulp.
Run (you'd have to do this in all projects):
$ npm run gulp
So it's definitely easier to install it globally.