Tôi có nhiệm vụ gulp được thiết lập và chạy để tạo ứng dụng Angular và nó chạy mà không có lỗi và tạo tệp một cách chính xác, nhưng khi tôi tải trang trên trình duyệt, tôi nhận được thông báo lỗi sau .Gulp Task Breaking on Angular Files
Có một số bước hoặc một số plugin mà tôi thiếu để có được tệp Angular cho tất cả "công việc" không? Tôi đã sử dụng các plugin angularFilesort() và ngAnnotate() rồi.
var bower = gulp.src(bower_files)
.pipe(concat("bower-expanded.js"))
.pipe(gulp.dest(paths.prod))
.pipe(rename("bower.js"))
.pipe(uglify())
.pipe(gulp.dest(paths.prod + paths.js));
// gather and compress the app's js files
var app = gulp.src(paths.source + "app/**/*.js")
.pipe(angularFilesort())
.pipe(concat("app-expanded.js"))
.pipe(ngAnnotate({
add: true,
single_quotes: true
}))
.pipe(gulp.dest(paths.prod))
.pipe(rename("app.js"))
.pipe(uglify())
.pipe(gulp.dest(paths.prod + paths.js));
Các lỗi là
TypeError: (intermediate value)(...) is not a function
(function(angular) {
mà chỉ vào những dòng mã
(function(angular) {
'use strict';
/**
* Called with an array this acts like map, otherwise it acts like _.mapValues
* in lodash.
* @return {Array|Object} The same type as the input argument.
*/
var mapValues = function(obj, callback) {
if (angular.isArray(obj))
Các lỗi khác là
Error: [$injector:modulerr] Failed to instantiate module app due to:
[$injector:modulerr] Failed to instantiate module angularSpinner due to:
[$injector:nomod] Module 'angularSpinner' is not available!
You either misspelled the module name or forgot to load it.
If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.4.4/$injector/nomod?p0=angularSpinner
Đó là những gì mà chú thích thực hiện. –
@Shaun Scovil Tôi không biết gì về ngAnnotate. Cảm ơn đã nói với tôi, tôi sẽ phải kiểm tra điều đó. – Ohjay44