Gulp install works but gulp is not responding - javascript

I am following the "gulp quick start" and everything is getting installed without error messages neither warnings. But when I try to check the gulp version on the end of the "gulp quick start" it returns
'gulp' is not recognized as an internal or external command,operable program or batch file.
The gulp quick start: GULP
When I check the first things in the "gulp quick start" the "check for node,npm and npx" it all works fine. I am getting normal responses.
The next step is installing gulp
When I install gulp evereything goes whell, the files are being created there our no error/ warnings displayed.
BUT when I am trying to run a gulp command on the end of the installation to test if gulp works. it returns gulp' is not recognized as an internal or external command,operable program or batch file.
I tried installing it multiple times. I have no idea what i am doing wrong.
Any help is welcome.
My device is running windows 10

I have no idea why but... my npm was broken.
I tried to download something with npm but that did not work ass well so I figured my npm was broken.
When I reinstalled npm everything worked fine.

Related

Jest: `npm test` not displaying "Watch Usage" options in Windows Git Bash

I am new to React and attempting to use npm test.
From the docs, it is my understanding that every time npm test runs, it starts the watcher. The watcher is supposed to display a list of commands titled "Watch Usage". This includes commands such as a, f and q.
When I run npm test, watcher appears to work because it runs the tests and reruns them if I save a file.
However, it does not display the "Watch Usage" list and if I type any of the "Watch Usage" commands, nothing happens.
How can I enable the "Watch Usage" commands?
I was attempting to run this command in Git Bash. I have not found a solution to make it work in Git Bash.
However, you can instead run the command in cmd.exe and it will work properly.
The Jest VSCode extension can also be helpful.
There is a problem with running Jest inside Git Bash on Windows. The terminal codes for updating the screen are not correctly handled, and I've been unable to find a reason or fix for this searching Google.
If you run npm test from a DOS prompt, then it seems to work fine, but if you run npm test from a Git Bash prompt the progress feedback from Jest is missing.
You can enable colors by running npm run test -- --colors which gets Jest to output the color status for tests in Git Bash, but strangely the colors are working but the progress is still not shown.
The only successful work around that I've found is running Jest from inside winpty if you're using Git Bash.
winpty npm.cmd test
So what I do is add an alternative npm script to my package.json file for running on Git Bash inside Windows.
"wintest": "winpty npm.cmd run test",
Then you can just run that instead.
npm run wintest
It's not a perfect solution, but at least you can see the progress correctly.
You can activate watch mode, modify your package.json:
"scripts": {
"test": "jest --watch",
}
run npm test

Unable to test my react program, yarn start and test don't work

So I have JUST started learning React Native to try and learn app development. So I started with a tutorial.
Everything was going fine until I tried running the command yarn start in the terminal to start the server and program and I got the following error message:
error Command "start" not found.
I also tried yarn test but got a similar error:
error Command "test" not found.
I started doing research on why this would happen but I haven't found a solution yet. As you can see from the image my package.json has the start and test commands in it
I've checked for yarn with yarn --version and it gives me 1.17.3 so I know it exists. I also have node installed.
I should be able to start the app with the yarn start command as he does it in the tutorial but it won't find the command.
It looks like you're trying to run the yarn test inside the parent folder of where the package.json is located. Try to cd into the react-tut/ folder using cd react-tut and then run yarn test. This should execute the test script that you have in the package.json file, as expected.

After npm reads package.json, what runs Electron?

I'm just starting to learn about how JavaScript, HTML, and Electron all work, and I want to know what runs electron . in the "scripts" -> "start" of package.json, because I can't tell what does and that kind of wizardry makes me nervous.
According to the man pages for npm, what npm start does is that it reads the package.json, looks at the script under "scripts" -> "start" -> some_script, and then runs some_script. Sometimes, some_script is something like node foobar.js, which makes sense to me, since I can run that from the command line. NodeJS is executing foobar.js. However, in the case of the electron-api-demos, some_script is electron .
You can download and run electron-api-demos via
git clone https://github.com/electron/electron-api-demos
cd electron-api-demos/
npm install && npm start
In order to try to figure out what is running electron ., I've run it in the node shell, and I've tried running node main.js. I've even tried opening up the node shell and running
electron-api-demos#2.0.2 start $DIR/electron-api-demos
electron .
(which is exactly the output of npm start). None of them worked, because none of them started up the Electron application. At this point I'm very puzzled at how, exactly, the start script gets executed at all.
So I guess my question is: does there exist a command (that I can use on the command line) to start up this Electron application, without using npm? If not, what is npm calling to start up this Electron app?
I apologize if this question has been asked before, but I all the sources I found didn't seem to go into any further detail about what, exactly, is done when npm start is run and how it executes electron . . Thank you for your time!
Command line interfaces installed with npm are put in the node_modules/.bin/ directory. You can't just run them from the command line because that directory isn't in your PATH (unless you put it there, or you installed it globally).
So, if you want to run electron without npm start, you can run ./node_modules/.bin/electron .. Since this is a bit verbose, newer versions of npm provide the command npx to run things without the ./node_modules/.bin/ part, so npx electron . also works.
Since npm scripts often use the packages you've installed, they automatically add node_modules/.bin/ to the PATH before running your command. As a result, the start script can just reference electron directly.
npx can do some other cool things too – npm has a blog post about it.
When you run npm start , it by default run command corresponding "start" key of script property of package.json like
"script":{
"start": "ng serve",
"launch":"electron main.js" or "electron ." // main.js located in the same dir
"test": " ng test"
}
same when you run npm run launch it will trigger the command corresponding of the "launch" key of script property of package.json file. like run electron main.js command and your application will launched.
so if you want to run the your electron application directly like electron main.js then install the electron module globally using command npm install electron -g then simply run the electron main.js command and your application will start.

npm Grunt loads, but then grunt command unrecognized

I have used grunt on this computer before for other projects (4 months ago), and recently wanted to use grunt for a new project. I loaded grunt globally and then locally, but after that typing in $ grunt -v says grunt is not recognized as if it is not loaded, or perhaps the path is wrong? anyone got any ideas?
Update: 5/16/2016, I tried the below suggestion and loaded casper-cli globally and locally, and the grunt command still fails. Additionally, I tried another command 'casperjs' and that one is also failing even though that has worked perfectly for the last year or so. It appears all of my commands are not working anymore, what could possibly cause that?
You have to install the grunt-cli globally to use grunt in the console:
npm install grunt-cli -g

Trouble with installing Selenium(ChromeDriver, Javascript) on Windows 7

I'm having trouble installing Selenium and I'm completely lost
I followed this documentation by the letter and looked around the site and the web for a while now and came to a dead end. Like I said in the title I'm using Chrome and Javascript for this.
[Documentation]http://selenium.googlecode.com/git/docs/api/javascript/index.html
So true with the documentation, the first thing I did was installing the "selenium-webdriver" which I opened up cmd and typed "npm install selenium-webdriver". It responded with saying what directory it installed and the version it installed which was 2.42.1.
After this I installed the ChromeDriver 2.10 from their home download page. After this I unziped the file and moved chromedriver.exe to "node_modules\selenium-webdriver\ChromeDriver" and added it to my systems environmental variables.
So then the next step was to test it, so I copy pasted "npm test selenium-webdriver" into the cmd and got this following error. [Error]http://imgur.com/xIYE3oa I also tried running ChromeDriver after I kept running into this error and tried it again to get the same result. It doesn't tell me anything other then...
Starting ChromeDriver on port 9515
Only local connections are allowed.
Thank you in advance.
First, make sure that you have Mocha installed by running npm install mocha.
You will then want to edit the "scripts" section of the package.json file for selenium-webdriver to match the following:
"scripts": {
"test": "mocha -R list --recursive test"
},
After completing those two steps, you should be able to run your tests with the npm test selenium-webdriver command.

Categories