输入cmd grunt jshint时发生错误。
问题描述:
我目前正在学习如何使用史蒂夫·富特编程。我使用Ubuntu作为操作系统。我安装了Node.js,安装了grunt命令行,并将npm install安装到了正确的文件夹中。 我注意到一个问题,当我在指定的文件夹上运行节点时,它不会运行我拥有的js文件。我甚至去了与js文件的文件夹,它没有工作。然后我尝试了节点values.js,但没有出现。输入cmd grunt jshint时发生错误。
这是我对的package.json文件代码:
{
"name": "kittenbook",
"version": "0.0.1",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-jshint": "~0.6.3"
}
}
这是Gruntfile.js
module.exports = function(grunt) {
//Project Configuiration
grunt.initConfig({
/*
* We will configuire our tasks here
*/
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 load our plugins here
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-jshint');
//We will register our tasks here
grunt.registerTask('default', ['jshint', 'concat', 'copy']);
};
如果对不起格式是坏这里真的是所有列队文本文件。
当我键入咕噜jshint警告过来说:
Loading "Gruntfile.js" tasks...ERROR
>> SyntaxError: Unexpected token {
Warning: Task "jshint" not found. Use --force to continue.
Aborted due to warnings.
答
你缺少一个冒号(:)在您的grunt.initConfig对象。
copy: { release{ /*<--Missing colon in between "release" and the opening bracket {*/ src: 'manifest.json', dest: 'release/manifest.json' } },
你预期会发生什么?意思是,你期望运行什么命令,你期望它的输出是什么? – stone
当我输入命令节点时出现提示。但它应该运行我拥有的java文件。当我输入prompt.js到提示符时,它给了我一个错误: 'ReferenceError:prompt is not defined' – Mo920192