Gulp 在 Windows 上运行失败 |错误消息:Microsoft JScript 编译错误,无效字符

2022-01-12 00:00:00 node.js windows-7-x64 javascript gulp

我在我的 Windows 7 本地机器上安装了 Node.js,因为这个链接说:
install-node-js-npm-windows

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

之后我通过命令行通过这个命令安装了Gulp.js:

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:UsersMajidAppDataRoaming pm ode_modulesgulpin

C:UsersMajidAppDataRoaming pm ode_modulesgulpin

现在当我尝试通过这个命令运行 gulp 时:

Now when i try to run gulp by this command :

gulp

我收到了这个错误:

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

我该如何解决这个错误&如何使 gulp.js 在 Windows 操作系统上可用?
<小时>回答后
错误仍然存​​在.
我去了这条路:

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:UsersUser_NameAppDataRoaming pm ode_modulesgulpin

C:UsersUser_NameAppDataRoaming pm ode_modulesgulpin

在命令行中尝试了这个命令:

In command line and tried this command :

node gulp.js install  

但它告诉我们:

没有找到 gulpfile

No gulpfile found

您应该知道 gulp 在前面的步骤中已成功安装.(带有一些警告)
gulp.js 的结构适​​用于基于 linux 的操作系统.
我正在寻找一种使该文件在 Windows 操作系统上可用的方法.



用法:
我想在我的本地机器上运行 这个基于 javascript 的网站...

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...

推荐答案

你需要运行node node_modulesgulpingulp.js install",在它前面加上node"命令,同时参考更多详情请点击下方链接

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

在 Windows 10 上运行 gulp 时出错

我无法发表评论,但您是否在 fork 存储库后运行npm install"来安装 package.json dependencies, dev-dependencies"?

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

Gulp 需要全局安装,也需要安装在您当前的工作目录中.

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

运行以下代码全局安装 Gulp,另一个安装存储库依赖项.

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:UsersMajidAppDataRoaming pm ode_modulesgulpin

C:UsersMajidAppDataRoaming pm ode_modulesgulpin

到环境变量区.

我去了根文件夹在cmd &全局重新安装 gulp 并重新运行 npm install &最后 gulp watch 工作得很好.

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

相关文章