Search code examples
npmgulpnpm-scripts

Executing npm script(gulp) which is located inside a folder


I have the following structure:

main folder
 - src 
 - node modules
 - gulpfiles.js
 - package.json 

In package.json

"scripts": {
    "tasks": "gulp tasks",

It works, but if I change the structure to:

main folder
 - src 
 - node modules
 - gulp
    - gulpfiles.js
    - gulp.config.js
 - package.json 

In package.json

"scripts": {
    "tasks": "gulp/gulp tasks", or "tasks": "gulp tasks",

it gives me the error 'no gulpfile found"


Solution

  • Utilize gulp's --gulpfile flag to specify the location of your gulpfile.js.

    For instance configure your tasks script in package.json as follows:

    "scripts": {
      "tasks": "gulp --gulpfile gulp/gulpfile.js tasks"
    },