Grunt不加载

请忍受我,因为我是新的节点和咕噜声。

当我运行Grunt使用:

Wine-MacBook-JT:sass-test jthomas$ grunt 

我得到以下错误:

加载“Gruntfile.js”任务…错误

错误:无法parsing位置248处的JSON中的“package.json”文件(意外的标记)。 警告:找不到任务“默认”。 使用–force继续。

不知道是什么问题。 我的JSON代码是:

 { "name": "sass-test", "version": "1.0.0", "description": "Simple test project for Grunt and Sass", "main": "Gruntfile.js", "devDependencies": { "grunt": "^0.4.5", "grunt-contrib-sass": "^1.0.0", "grunt-contrib-watch@1.0.0" } } 

我的目录结构设置为

 ||sass-test ||.sass-cache ||.node-modules SCSS ||_main.scss ||_mixins.scss ||_style.scss Gruntfile.js package.json 

package.json"grunt-contrib-watch@1.0.0"行是无效的json。

我会删除该行,并使用npm install --save-dev grunt-contrib-watch将其重新添加到package.json中。 否则,只需手工修改它就像:

 "grunt-contrib-watch": "^1.0.0" 

并且确保你再次npm install ,如果你手工修改了package.json ,因为很有可能没有安装package。

以下是完整的package.json blob:

 { "name": "sass-test", "version": "1.0.0", "description": "Simple test project for Grunt and Sass", "main": "Gruntfile.js", "devDependencies": { "grunt": "^0.4.5", "grunt-contrib-sass": "^1.0.0", "grunt-contrib-watch": "^1.0.0" } } 

尝试将“grunt-contrib-watch@1.0.0”更改为“grunt-contrib-watch”:“^ 1.0.0”