Gulp 失败并显示消息:预期对象 [英] Gulp fails with message: object expected
问题描述
我正在尝试在 w7 上使用 gulp.gruntjs 有效.. 节点有效...如果我在没有 gulp 文件的情况下启动 gulp,它运行良好.. 说找不到 gulpfile"
I'm trying to use gulp on w7. gruntjs works .. node works ... If i start gulp without gulp file, it runs fine .. saying 'no gulpfile found'
gulp -v 给出:cli 版本 3.5.6,本地版本 3.5.6
gulp -v gives: cli version 3.5.6, local version 3.5.6
使用以下方式安装它:npm install -g gulpnpm install --save-dev gulp
installed it using: npm install -g gulp npm install --save-dev gulp
如果我使用以下 gulpfile:
If I use the following gulpfile:
var gulp = require('gulp');
导致错误对话框:
Windows Script Host
Line 1
Char 1
Object Expected
800A138F
Microsoft JScript runtime error
我确实尝试了一个更长的 gulp 文件,但同样的错误......通过删除行,我试图隔离问题......直到文件为空......没关系.
I did try a more lengthy gulp file, but same error ... by deleting lines, I tried to isolate the problem .. until the file was empty .. that was ok.
有什么想法吗?
推荐答案
以下是我用来解决该问题的步骤:
Here are steps I used to solve that issue:
- 如果您的任务文件是
gulp.js
,请将其重命名为gulpfile.js
- 全局安装 gulp
>npm install -g gulp
- 测试安装
>gulp -v
- if your tasks file is
gulp.js
, rename it togulpfile.js
- Install gulp globally
> npm install -g gulp
- Test installation
> gulp -v
如果你能看到你的 gulp 任务运行器的版本号就很好了!
You are good if you can see the version number of your gulp task runner!
这篇关于Gulp 失败并显示消息:预期对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!