我希望我的Package.json是这样的
{
"name": "Billing",
"version": "0.0.0",
"dependencies": {
"grunt": "~0.4.1",
"grunt-contrib-watch": "~0.5.3",
"grunt-contrib-compass": "~0.5.0",
"grunt-contrib-uglify": "~0.2.2",
"grunt-contrib-cssmin": "~0.6.2",
"matchdep": "~0.1.2"
},
"devDependencies": {
"grunt-contrib-handlebars": "~0.5.4",
"grunt-contrib-less": "~0.8.1"
}
}
Run Code Online (Sandbox Code Playgroud)
我试过这个npm install但是得到了这个错误
package.json必须是实际的JSON,而不仅仅是JavaScript.
所以我使用命令行来创建json,并添加了依赖项.我发现大多数软件包都是在没有出现这种错误的情况下安装的,而且我的package.json也通过使用npm install grunt-contrib-watch --save-dev等方式得到了正确的更新.
在Windows上我看到这个错误仅针对两个包:对于grunt-contrib-uglify"以及grunt-contrib-handlebars.所以我的JSON文件结束于
{
"name": "Billing",
"version": "0.0.0",
"dependencies": {
"grunt": "~0.4.1",
"grunt-contrib-watch": "~0.5.3",
"grunt-contrib-compass": "~0.5.0",
"grunt-contrib-cssmin": "~0.6.2",
"matchdep": "~0.1.2"
},
"devDependencies": {
"grunt-contrib-less": "~0.8.1"
}
}
Run Code Online (Sandbox Code Playgroud) 请参阅jsfiddle链接http://jsfiddle.net/Bjf7c/1/并解释为什么在我们选择另一个项目并返回到第一个选定项目后,点击功能不起作用.它看起来很奇怪,因为所有相似的项目都会触发点击功能,但不会触发默认的选定项目.
在示例中,首先单击F,然后单击E.您会发现除E外,所有其他项目都是可点击的.
$(".items.cursor:not('.selected')").on('click',function(){
$('.items.selected').removeClass('selected');
$(this).addClass('selected');
});
Run Code Online (Sandbox Code Playgroud)