angularjs gulp build fail angular not defined

时间:2016-05-14 02:58:41

标签: angularjs gulp

您好我在几秒钟后使用gulp build命令构建应用程序显示错误"角度未定义"还有几个错误,这是日志:

    {lamb} gulp build
[23:45:11] Requiring external module babel-register
[23:45:13] Using gulpfile C:\Apps\test\gulpfile.babel.js
[23:45:13] Starting 'lint'...
[23:45:14] Starting 'styles'...
[23:45:15] Starting 'scripts'...
[23:45:15] Starting 'images'...
[23:45:16] Starting 'fonts'...
[23:45:16] Starting 'extras'...
[23:45:16] Finished 'images' after 923 ms
[23:45:16] Finished 'fonts' after 90 ms
[23:45:16]
C:\Apps\test\app\scripts\main.js
   3:10  error  "angular" is not defined             no-undef
   5:34  error  A space is required after ','        comma-spacing
   9:12  error  Extra space after key "controller"   key-spacing
  10:11  error  Trailing spaces not allowed          no-trailing-spaces
  12:11  error  Extra space after key "templateUrl"  key-spacing
  13:12  error  Extra space after key "controller"   key-spacing
  16:10  error  Extra space after key "templateUrl"  key-spacing
  17:12  error  Extra space after key "controller"   key-spacing

C:\Apps\test\app\scripts\controllers\controllerView.js
  2:1  error  "angular" is not defined  no-undef

✖ 9 problems (9 errors, 0 warnings)

[23:45:16] 'lint' errored after 3.17 s
[23:45:16] ESLintError in plugin 'gulp-eslint'
Message:
    Failed with 9 errors
[23:45:16] Finished 'styles' after 2.07 s
[23:45:16] Finished 'extras' after 609 ms
[23:45:16] Finished 'scripts' after 1.53 s

1 个答案:

答案 0 :(得分:0)

将此添加到.eslintrc文件中:

{
    "globals": {
        "angular": true
    },
    // ...
}

有关详细信息,请参阅此问题的已接受答案:

ESLint's "no-undef" rule is calling my use of Underscore an undefined variable