zoukankan      html  css  js  c++  java
  • TypeError: Cannot read property 'apply' of undefined

    1、错误描述

    
    Administrator@USER-0GUONPPBHK MINGW64 /g/HBuilderXWork/Vue
    $ npm install --save-dev gulp
    npm WARN rollback Rolling back readable-stream@2.3.6 failed (this is probably ha                                                                                                              rmless): EPERM: operation not permitted, scandir 'G:HBuilderXWorkVue
    ode_modu                                                                                                              lesfsevents
    ode_modules'
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modulesfse                                                                                                              vents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@                                                                                                              1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}                                                                                                              )
    
    + gulp@4.0.2
    added 123 packages from 98 contributors and audited 20796 packages in 55.493s
    found 1 moderate severity vulnerability
      run `npm audit fix` to fix them, or `npm audit` for details
    
    Administrator@USER-0GUONPPBHK MINGW64 /g/HBuilderXWork/Vue
    $ gulp
    [11:17:12] Using gulpfile G:HBuilderXWorkVuegulpfile.js
    C:UsersAdministrator.USER-0GUONPPBHKAppDataRoaming
    pm
    ode_modulesgulpin                                                                                                              gulp.js:129
        gulpInst.start.apply(gulpInst, toRun);
                       ^
    
    TypeError: Cannot read property 'apply' of undefined
        at C:UsersAdministrator.USER-0GUONPPBHKAppDataRoaming
    pm
    ode_modulesg                                                                                                              ulpingulp.js:129:20
        at processTicksAndRejections (internal/process/next_tick.js:74:9)
    
    Administrator@USER-0GUONPPBHK MINGW64 /g/HBuilderXWork/Vue
    $ npm install --global gulp
    F:
    odejs
    ode_globalgulp -> F:
    odejs
    ode_global
    ode_modulesgulpingulp.js
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modulesgulp
    ode_modulesfsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
    
    + gulp@4.0.2
    added 314 packages from 217 contributors in 57.46s
    
    Administrator@USER-0GUONPPBHK MINGW64 /g/HBuilderXWork/Vue
    $ gulp
    [11:19:40] Using gulpfile G:HBuilderXWorkVuegulpfile.js
    C:UsersAdministrator.USER-0GUONPPBHKAppDataRoaming
    pm
    ode_modulesgulpingulp.js:129
        gulpInst.start.apply(gulpInst, toRun);
                       ^
    
    TypeError: Cannot read property 'apply' of undefined
        at C:UsersAdministrator.USER-0GUONPPBHKAppDataRoaming
    pm
    ode_modulesgulpingulp.js:129:20
        at processTicksAndRejections (internal/process/next_tick.js:74:9)
        at process.runNextTicks [as _tickCallback] (internal/process/next_tick.js:51:3)
        at Function.Module.runMain (internal/modules/cjs/loader.js:777:11)
        at executeUserCode (internal/bootstrap/node.js:499:15)
        at startMainThreadExecution (internal/bootstrap/node.js:436:3)
    
    Administrator@USER-0GUONPPBHK MINGW64 /g/HBuilderXWork/Vue
    $ npm i gulp-cli -g
    F:
    odejs
    ode_globalgulp -> F:
    odejs
    ode_global
    ode_modulesgulp-cliingulp.js
    + gulp-cli@2.2.0
    added 235 packages from 156 contributors in 14.086s
    
    Administrator@USER-0GUONPPBHK MINGW64 /g/HBuilderXWork/Vue
    $ gulp
    [11:21:09] Using gulpfile G:HBuilderXWorkVuegulpfile.js
    C:UsersAdministrator.USER-0GUONPPBHKAppDataRoaming
    pm
    ode_modulesgulpingulp.js:129
        gulpInst.start.apply(gulpInst, toRun);
                       ^
    
    TypeError: Cannot read property 'apply' of undefined
        at C:UsersAdministrator.USER-0GUONPPBHKAppDataRoaming
    pm
    ode_modulesgulpingulp.js:129:20
        at processTicksAndRejections (internal/process/next_tick.js:74:9)
        at process.runNextTicks [as _tickCallback] (internal/process/next_tick.js:51:3)
        at Function.Module.runMain (internal/modules/cjs/loader.js:777:11)
        at executeUserCode (internal/bootstrap/node.js:499:15)
        at startMainThreadExecution (internal/bootstrap/node.js:436:3)
    
    Administrator@USER-0GUONPPBHK MINGW64 /g/HBuilderXWork/Vue
    $ npm install --save-dev gulp
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modulesfsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
    
    + gulp@4.0.2
    added 19 packages from 10 contributors and audited 20796 packages in 16.836s
    found 1 moderate severity vulnerability
      run `npm audit fix` to fix them, or `npm audit` for details
    
    Administrator@USER-0GUONPPBHK MINGW64 /g/HBuilderXWork/Vue
    $ gulp
    [11:24:14] Using gulpfile G:HBuilderXWorkVuegulpfile.js
    C:UsersAdministrator.USER-0GUONPPBHKAppDataRoaming
    pm
    ode_modulesgulpingulp.js:129
        gulpInst.start.apply(gulpInst, toRun);
                       ^
    
    TypeError: Cannot read property 'apply' of undefined
        at C:UsersAdministrator.USER-0GUONPPBHKAppDataRoaming
    pm
    ode_modulesgulpingulp.js:129:20
        at processTicksAndRejections (internal/process/next_tick.js:74:9)
        at process.runNextTicks [as _tickCallback] (internal/process/next_tick.js:51:3)
        at Function.Module.runMain (internal/modules/cjs/loader.js:777:11)
        at executeUserCode (internal/bootstrap/node.js:499:15)
        at startMainThreadExecution (internal/bootstrap/node.js:436:3)
    
    Administrator@USER-0GUONPPBHK MINGW64 /g/HBuilderXWork/Vue
    $
    

    2、错误描述

          在vue.js项目中安装了gulp,并创建一个gulpfile.js文件,然后使用gulp命令进行编译,结果报这个错误

    let gulp = require('gulp');
    
    gulp.task('default',function() {
    	console.log('aaaaa');
    });

    3、解决办法

    (1)gulp版本不匹配,将项目中的gulp删除,重新下载

    (2)全局安装gulp-cli,并检查gulp和gulp-cli版本是否一致

    Administrator@USER-0GUONPPBHK MINGW64 /g/HBuilderXWork/Vue
    $ gulp -version
    [11:30:36] CLI version 3.9.1
    [11:30:36] Local version 4.0.2
    
    Administrator@USER-0GUONPPBHK MINGW64 /g/HBuilderXWork/Vue
    $ npm i gulp@3.9.1 -S
    npm WARN deprecated gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
    npm WARN deprecated graceful-fs@3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
    npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
    npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
    npm WARN deprecated graceful-fs@1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
    npm WARN deprecated natives@1.1.6: This module relies on Node.js's internals and will break at some point. Do not use it, and update to graceful-fs@4.x.
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modulesfsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
    
    + gulp@3.9.1
    added 73 packages from 38 contributors, removed 58 packages, updated 11 packages, moved 1 package and audited 15512 packages in 25.431s
    found 7 vulnerabilities (1 low, 1 moderate, 5 high)
      run `npm audit fix` to fix them, or `npm audit` for details
    
    Administrator@USER-0GUONPPBHK MINGW64 /g/HBuilderXWork/Vue
    $ gulp
    [11:32:45] Using gulpfile G:HBuilderXWorkVuegulpfile.js
    [11:32:45] Starting 'default'...
    aaaaa
    [11:32:45] Finished 'default' after 125 μs
    
    Administrator@USER-0GUONPPBHK MINGW64 /g/HBuilderXWork/Vue
    
  • 相关阅读:
    网络安全之常见攻击
    引入element-ui
    引入sass
    浏览器解析流程
    JDK8 HashMap--removeNode()移除节点方法
    JDK8 HashMap--treeify()树形化方法
    JDK1.8 HashMap--treeifyBin()方法
    二叉查找树ADT
    队列ADT

  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13313703.html
Copyright © 2011-2022 走看看