Grunt / JSHint安装错误 [英] Grunt/JSHint installation error
问题描述
已安装Node.js
现在我正在安装NPM,但首先导航到目录:
/ Users / MR / Desktop / kittenbook
然后我执行命令 npm
该命令似乎执行正确地根据书籍输出结果。
我输入的下一个命令是,并收到以下错误:
Mannys-MacBook-Pro:kittenbook mannyr $ 〜/ Desktop / kittenbook / sudo npm install -g grunt-cli
-bash:/ Users / MR / Desktop / kittenbook /:是一个目录
因此,我试过了:
Mannys-MacBook-Pro: kittenbook mannyr $ sudo npm install -g grunt-cli
我收到以下输出:
/ usr / local / bin / grunt - > / usr / local / lib / node_modules / grunt-cli / bin / grunt
grunt-cli@0.1.13 / usr / local / lib / node_modules / grunt-cli
├──resolve@0.3。 1
├──nopt@1.0.10(abbrev@1.0.7)
└──findup-sync@0.1.3(lodash@2.4.2,glob@3.2.11)
这里是我的档案:
GruntFile.js
module.exports = function(grunt){
//项目配置
grunt.initConfig({
concat:{
release:{
src:['js / values.js','js / prompt.js'],
dest:'release / main.js'
复制{b $ b复制:{
src:'manifest.json',
dest:'release / manifest.json'
}
},
jshint:{
files:['js / values.js','js / prompt.js']
}
});
//我们将在这里加载grunt插件
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-jshint');
//我们将在这里注册任务
grunt.registerTask('default',['jshint','concat','copy']);
};
package.json
{
name:kittenbook,
version:0.0.1,
devDependencies:{
grunt:〜0.4.2,
grunt-contrib-concat:〜0.3.0,
grunt- contrib-jshint:〜0.6.3,
grunt-contrib-copy:〜0.5.0
}
}
当我尝试运行以下命令时,我收到此问题:
Mannys-MacBook-Pro:kittenbook mannyr $ grunt jshint
警告:找不到任务jshint。使用--force继续。
由于警告而中止。
问题是文件名GruntFile.js,应该有一直是Gruntfile.js
Im new to development and im using Steven Foote's book "learning to program" im currently trying to finish a portion of the project that requires you to install Node.js and Grunt. I seem to be having a problem with installing grunt.. hope the following makes sense.
i Installed Node.js
now im moving towards installing NPM, but first i navigate to the directory:
/Users/MR/Desktop/kittenbook
then i execute the command npm
the command seems to execute correctly, based off the books output results. the next command i entered is, and receive the following error:
Mannys-MacBook-Pro:kittenbook mannyr$ ~/Desktop/kittenbook/ sudo npm install -g grunt-cli
-bash: /Users/MR/Desktop/kittenbook/: is a directory
so instead i'ved tried:
Mannys-MacBook-Pro:kittenbook mannyr$ sudo npm install -g grunt-cli
i receive the following output:
/usr/local/bin/grunt -> /usr/local/lib/node_modules/grunt-cli/bin/grunt
grunt-cli@0.1.13 /usr/local/lib/node_modules/grunt-cli
├── resolve@0.3.1
├── nopt@1.0.10 (abbrev@1.0.7)
└── findup-sync@0.1.3 (lodash@2.4.2, glob@3.2.11)
here are my files:
GruntFile.js
module.exports = function(grunt){
// project configuration
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 load grunt plugins here
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-jshint');
// we will register tasks here
grunt.registerTask('default', ['jshint', 'concat', 'copy']);
};
package.json
{
"name": "kittenbook",
"version": "0.0.1",
"devDependencies":{
"grunt":"~0.4.2",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-jshint": "~0.6.3",
"grunt-contrib-copy": "~0.5.0"
}
}
when i try running the following command i receive this issue:
Mannys-MacBook-Pro:kittenbook mannyr$ grunt jshint
Warning: Task "jshint" not found. Use --force to continue.
Aborted due to warnings.
issue was the file name GruntFile.js, should have been Gruntfile.js
这篇关于Grunt / JSHint安装错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!