Gulp run fails on windows | Error Message : Micros

2019-02-21 20:25发布

问题:

I installed Node.js on my windows 7 local machine as this link says :
install-node-js-npm-windows

After that i installed Gulp.js by this command through command line :

npm install -g gulp

And then i add this path to environment variables area :

C:\Users\Majid\AppData\Roaming\npm\node_modules\gulp\bin

Now when i try to run gulp by this command :

gulp

I got this error :

Windows Script Host
Line: 1
Char: 1
Error: Invalid character
Code: 800A03F6
Source: Microsoft JScript compilation error   

How can i solve this error & how can i make gulp.js workable on windows OS?


EDIT AFTER THE ANSWER :
Error is still there.
I went to this path :

C:\Users\User_Name\AppData\Roaming\npm\node_modules\gulp\bin

In command line and tried this command :

node gulp.js install  

But it tells :

No gulpfile found

You should know gulp was installed in previous steps successfully.(With some warnings)
The structure of gulp.js is for linux based operating systems.
I am looking for a way to make this file workable on windows os.



USAGE :
I want to run this javascript based web site on my local machine...

回答1:

You need to run "node node_modules\gulp\bin\gulp.js install", just add "node" command in front of it and also refer to the link below for more

Error running gulp on Windows 10

I can't comment but did you run "npm install" after forking the repository, to install package.json "dependencies, dev-dependencies"?

Gulp need to be installed Globally and also in your current working directory.

Run the code below to installed Gulp globally, and the other to install the repository dependencies.

npm install -g gulp
npm install

This answer is correct, But what was the problem in my side?
I shouldn't add this path :

C:\Users\Majid\AppData\Roaming\npm\node_modules\gulp\bin

To environment variable area.

I went to the root folder in cmd & reinstalled gulp globally and re ran npm install & finally gulp watch worked very well.