2

I need to run gulp in windows 8 with this command:

npm run gulp

But I see the following error in cmd and npm-debug.log after attempting to run that command:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'gulp' ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: missing script: gulp
4 verbose stack     at run (C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:142:19)
4 verbose stack     at C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:58:5
4 verbose stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:345:5
4 verbose stack     at checkBinReferences_ (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:309:45)
4 verbose stack     at final (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:343:3)
4 verbose stack     at then (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:113:5)
4 verbose stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:232:12
4 verbose stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:76:16
4 verbose stack     at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)
5 verbose cwd C:\Users\UserN\Desktop\App
6 error Windows_NT 6.2.9200
7 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "gulp"
8 error node v4.3.2
9 error npm  v2.14.12
10 error missing script: gulp
11 error If you need help, you may report this error at:
11 error     <https://github.com/npm/npm/issues>
12 verbose exit [ 1, true ]

EDIT:

gulpfile:

var gulp = require('gulp');

var requireDir = require('require-dir');
requireDir('./gulp-tasks');

gulp.task('default', ['sass', 'templatecache']);

How do I fix this problem and run gulp without error in my environment?

1
  • 1
    Can you share the code in your package.json file? Commented Mar 7, 2016 at 19:30

1 Answer 1

2

You do not have a gulp script defined in your package.json. Any command line command prefixed with npm run should be defined in the scripts section of the package.json. From the documentation:

This runs an arbitrary command from a package's "scripts" object.

You can either define a gulp script or you can run gulp from the command line:

gulp

From the getting started guide:

1. Install gulp globally:

$ npm install --global gulp

2. Install gulp in your project devDependencies:

$ npm install --save-dev gulp

3. Create a gulpfile.js at the root of your project:

var gulp = require('gulp');

gulp.task('default', function() {
  // place code for your default task here
});

4. Run gulp:

$ gulp
Sign up to request clarification or add additional context in comments.

2 Comments

What happens when you run gulp?
when i edit my template, $templatecache not create and write new edit template and i see always cache version. i think gulp not run and active.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.