我在终端中遇到问题
I'm having trouble with grunt in the terminal
我无法将我的终端正确设置为 运行 g运行t。我正在尝试创建一个新的 g运行t 文件并且我已经安装了 g运行t。而且我不知道为什么会给我这个错误。
Last login: Tue Jan 9 19:42:51 on ttys000
Nicks-MacBook-Pro:~ nickcameron$ cd projects
Nicks-MacBook-Pro:projects nickcameron$ cd kittenbook
Nicks-MacBook-Pro:kittenbook nickcameron$ grunt
Loading "Gruntfile.js" tasks...ERROR
>> SyntaxError: Unexpected identifier
Warning: Task "default" not found. Use --force to continue.
Aborted due to warnings.
Nicks-MacBook-Pro: kittenbook nickcameron$
这是我的 Gruntfile.js :
module.export = function (grunt){
//project configuartion
grunt.initConfig({
concat: {
release: {
src: ['js/values.js', 'js/prompt.js'],
dest: 'release/main.js'
}
},
copy: {
release: {
src: 'manifest.json',
dest: 'release/manifest.json'
}
}
jshint: {
files: ['js/values.js', 'js/prompt.js']
}
/*
* We will configure our tasks here
*/
});
// We will load Grunt plugins here
//Load Grunt plugins
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-jshint');
// We will register tasks here
//Register tasks
grunt.registerTask ('default', ['jshint', 'concat', 'copy']);
};
module.export
写错了,正确的是module.exports
,还忘了逗号。您的 gruntfiles.js
应如下所示:
module.exports = function (grunt){
//project configuartion
grunt.initConfig({
concat: {
release: {
src: ['js/values.js', 'js/prompt.js'],
dest: 'release/main.js'
}
},
copy: {
release: {
src: 'manifest.json',
dest: 'release/manifest.json'
}
}, // <----------------- missing comma here
jshint: {
files: ['js/values.js', 'js/prompt.js']
}
/*
* We will configure our tasks here
*/
});
// We will load Grunt plugins here
//Load Grunt plugins
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-jshint');
// We will register tasks here
//Register tasks
grunt.registerTask ('default', ['jshint', 'concat', 'copy']);
};
我无法将我的终端正确设置为 运行 g运行t。我正在尝试创建一个新的 g运行t 文件并且我已经安装了 g运行t。而且我不知道为什么会给我这个错误。
Last login: Tue Jan 9 19:42:51 on ttys000
Nicks-MacBook-Pro:~ nickcameron$ cd projects
Nicks-MacBook-Pro:projects nickcameron$ cd kittenbook
Nicks-MacBook-Pro:kittenbook nickcameron$ grunt
Loading "Gruntfile.js" tasks...ERROR
>> SyntaxError: Unexpected identifier
Warning: Task "default" not found. Use --force to continue.
Aborted due to warnings.
Nicks-MacBook-Pro: kittenbook nickcameron$
这是我的 Gruntfile.js :
module.export = function (grunt){
//project configuartion
grunt.initConfig({
concat: {
release: {
src: ['js/values.js', 'js/prompt.js'],
dest: 'release/main.js'
}
},
copy: {
release: {
src: 'manifest.json',
dest: 'release/manifest.json'
}
}
jshint: {
files: ['js/values.js', 'js/prompt.js']
}
/*
* We will configure our tasks here
*/
});
// We will load Grunt plugins here
//Load Grunt plugins
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-jshint');
// We will register tasks here
//Register tasks
grunt.registerTask ('default', ['jshint', 'concat', 'copy']);
};
module.export
写错了,正确的是module.exports
,还忘了逗号。您的 gruntfiles.js
应如下所示:
module.exports = function (grunt){
//project configuartion
grunt.initConfig({
concat: {
release: {
src: ['js/values.js', 'js/prompt.js'],
dest: 'release/main.js'
}
},
copy: {
release: {
src: 'manifest.json',
dest: 'release/manifest.json'
}
}, // <----------------- missing comma here
jshint: {
files: ['js/values.js', 'js/prompt.js']
}
/*
* We will configure our tasks here
*/
});
// We will load Grunt plugins here
//Load Grunt plugins
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-jshint');
// We will register tasks here
//Register tasks
grunt.registerTask ('default', ['jshint', 'concat', 'copy']);
};