Gulp fails with message: object expected

2019-03-18 00:42发布

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 gives: cli version 3.5.6, local version 3.5.6

installed it using: npm install -g gulp npm install --save-dev gulp

If I use the following gulpfile:

var gulp = require('gulp');

It results in error dialog:

Windows Script Host
Line 1
Char 1
Object Expected
800A138F
Microsoft JScript runtime error

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.

Any ideas?

标签: node.js gulp
2条回答
Root(大扎)
2楼-- · 2019-03-18 01:10

Here are steps I used to solve that issue:

  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

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

查看更多
Evening l夕情丶
3楼-- · 2019-03-18 01:28

If you're getting a Microsoft JScript runtime error it isn't running in node but rather in Windows Scripting Host. Ensure Node.exe is in your PATH.

查看更多
登录 后发表回答