我正在尝试使用grunt运行jasmine测试但是我收到此错误消息并且我不确定下一步解决它的问题。当我尝试使用grunt
运行jasmine时,这是实际的错误消息$ grunt jasmine:all
Loading "jasmine.js" tasks...ERROR
>> TypeError: Cannot read property '_' of undefined
Loading "Gruntfile.js" tasks...ERROR
>> TypeError: Cannot read property '_' of undefined
Warning: Cannot read property 'namespace' of undefined Use --force to continue.
Aborted due to warnings.
Fatal error: Cannot read property 'exit' of undefined
/Users/user1/dev/app/node_modules/grunt/lib/grunt/fail.js:57
grunt.util.exit(typeof errcode === 'number' ? errcode : fail.code.FATAL_ERROR);
^
TypeError: Cannot read property 'exit' of undefined
at Object.fail.fatal (/Users/user1/dev/app/node_modules/grunt/lib/grunt/fail.js:57:13)
at process.uncaughtHandler (/Users/user1/dev/app/node_modules/grunt/lib/grunt.js:130:10)
at emitOne (events.js:77:13)
at process.emit (events.js:169:7)
at process._fatalException (node.js:234:26)
我想在下一步尝试解决这个问题?
添加了gruntfile
module.exports = function(grunt){
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
//all configuration goes here
jshint: {
options: {
reporter: require('jshint-stylish')
},
build: ['Gruntfile.js','src/**/*.js']
},
uglify: {
options: {
banner: '/*\n <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> \n */\n'
},
build: {
files: {
'dist/js/bundle.min.js' :
[
'bower_components/angular/angular.js'
]
}
}
},
less: {
build: {
files: {
'dist/css/pretty.css' :
[
'src/css/pretty.less'
]
}
}
},
cssmin: {
options: {
banner: '/*\n <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> \n */\n'
},
build: {
files: {
'dist/css/style.min.css' :
[
'src/css/style.css'
]
}
}
},
watch: {
stylesheets: {
files: ['src/**/*.css', 'src/**/*.less'],
tasks: ['less', 'cssmin']
},
scripts: {
files: 'src/**/*.js',
tasks: ['jshint', 'uglify']
}
}
});
//loads grunt plugins
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.registerTask('default', ['jshint', 'uglify', 'cssmin', 'less']);
};