A
A
Anton Mitkevich2017-06-04 23:06:06
PHP
Anton Mitkevich, 2017-06-04 23:06:06

Building php files in Gulp --- TypeError: Cannot read property 'php' of undefined?

TypeError: Cannot read property 'php' of undefined
This error is displayed in the console when trying to build php files from one folder to another.
No actions are taken on the files, a normal ejection.
Path to files:

const path = {
    src: {
        _lcss:   'src/libs/*.css',
        _ljs:    'src/libs/*.js',
        js:      'src/js/*.js',
        phpsc:   'src/php/*.php',
        scss:    'src/sass/style.scss',
        img:     'src/img/*.*',
        svg:     'src/svg/*.svg',
        fonts:   'src/fonts/**/*.*',
        deploy:  'dist/**/*'
    },

    dist: {
        css:     'dist/css/',
        js:      'dist/js/',
        phpsc:   'dist/',
        img:     'dist/images/',
        fonts:   'dist/fonts/',
        scss:    'dist/'
    },

    watch: {
        js:      'src/js/*.js',
        phpsc:   'src/php/*.php',
        scss:    'src/sass/style.scss'
    },

    clear: 'dist'
};

Uploading php files:
gulp.task('php:build', () => {
    return gulp.src(path.src.phpsc)
        .pipe(gulp.dest(path.dest.phpsc))
});

Console error log:
$ gulp php:build
[23:51:07] Using gulpfile F:\Workspace\Builder\startps\builder\gulpfile.js
[23:51:07] Starting 'php:build'...
[23:51:07] 'php:build' errored after 7.15 ms
[23:51:07] TypeError: Cannot read property 'phpsc' of undefined
    at Gulp.gulp.task (F:\Workspace\Builder\startps\builder\gulpfile.js:80:34)
    at module.exports (F:\Workspace\Builder\startps\builder\node_modules\orchestrator\lib\runTask.js:34:7)
    at Gulp.Orchestrator._runTask (F:\Workspace\Builder\startps\builder\node_modules\orchestrator\index.js:273:3)
    at Gulp.Orchestrator._runStep (F:\Workspace\Builder\startps\builder\node_modules\orchestrator\index.js:214:10)
    at Gulp.Orchestrator.start (F:\Workspace\Builder\startps\builder\node_modules\orchestrator\index.js:134:8)
    at C:\Users\tonni\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:129:20
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)
    at Module.runMain (module.js:606:11)
    at run (bootstrap_node.js:393:7)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Mitkevich, 2017-06-05
@tonnisBlack

Closing question, syntax error =\

K
Kir ---, 2017-06-04
@SowingSadness

What does php have to do with it is not clear, but the error is somewhere in the script, which says that they are trying to look at a variable with a field named "php". And this variable has the value undefined (i.e., the value is not defined)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question