生成源映射时出错 – grunt和sassconfiguration

我正在尝试用咕噜声使用sass。 我在我的路上安装了ruby,ruby和咕噜声。
版本是,

节点:0.10.20
npm:1.3.11
咕噜咕噜:0.1.13
咕噜:0.4.5
sass:3.4.4

我的包json是,

"private": true, "devDependencies": { "express": "4.x", "grunt": "~0.4.1", "grunt-contrib-sass": "~0.3.0", "grunt-contrib-watch": "~0.4.4" } 

我的咕噜文件是,

 module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), sass: { dist: { files: { 'style/style.css' : 'sass/home.scss' } } }, watch: { css: { files: '**/*.scss', tasks: ['sass'] } } }); grunt.loadNpmTasks('grunt-contrib-sass'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.registerTask('default',['watch']); } 

现在,如果我尝试“咕噜”命令,我得到以下错误。 任何帮助?

运行:咕噜或咕噜手表或咕噜声

错误:

 Running "sass:dist" (sass) task Error: Error generating source map: couldn't determine public URL for the source stylesheet. No filename is available so there's nothing for the source map to link to. on line of standard input Use --trace for backtrace. Warning: Error: Error generating source map: couldn't determine public URL for t he source stylesheet. No filename is available so there's nothing for the source map to link to. on line of standard input Use --trace for backtrace. Use --force to continue. Aborted due to warnings. 

任何想法?

看起来你没有安装指南针。 你可以运行gem install compass 。 在你原来的例子中,你已经设置好了你的grunt文件来使用指南针,它可以让你访问指南针的混合和function。

你的代码现在看起来很好,应该工作,但似乎没有find你的文件。 当我在一台电脑旁边的时候,我也会走一走。

与此同时,您可以尝试sass任务上的sourcemap: none选项。

更新:

对我来说工作得很好。 你可以运行tree -I node_modules并发布输出(除非你认为有任何敏感信息)只是为了仔细检查文件是否在正确的位置?

我期待它看起来像这样

 . ├── Gruntfile.js ├── package.json ├── sass │  └── style.scss └── style ├── style.css └── style.css.map 

第二次更新:你的软件包似乎比我全新的设置中的要旧得多。 要么尝试从头开始或执行以下操作:

安装npm-check-updates

 npm install npm-check-updates 

然后运行以下

  • npm-check-updates会告诉你哪些软件包已经过期
  • npm-check-updates -u会更新你的package.json这些包
  • npm update以更新所有过期的软件包。

更新节点模块帮助..

npm-check-updates会告诉你哪些软件包已经过期npm-check-updates -u会更新你的package.json中的软件包npm update来更新你所有的过期软件包。