Gulp 失败并显示消息:预期对象 [英] Gulp fails with message: object expected

查看:18
本文介绍了Gulp 失败并显示消息:预期对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 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:

  1. 如果您的任务文件是 gulp.js,请将其重命名为 gulpfile.js
  2. 全局安装 gulp >npm install -g gulp
  3. 测试安装>gulp -v
  1. if your tasks file is gulp.js, rename it to gulpfile.js
  2. Install gulp globally > npm install -g gulp
  3. Test installation > gulp -v

如果你能看到你的 gulp 任务运行器的版本号就很好了!

You are good if you can see the version number of your gulp task runner!

这篇关于Gulp 失败并显示消息:预期对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆