Ruby 生成源映射时出错-grunt和sass配置

Ruby 生成源映射时出错-grunt和sass配置,ruby,node.js,sass,gruntjs,npm,Ruby,Node.js,Sass,Gruntjs,Npm,我试图用沙斯和咕噜。我已经在我的路径中安装了ruby、sass和grunt。 版本是, 节点:0.10.20 npm:1.3.11 grunt cli:0.1.13 咕噜声:0.4.5 sass:3.4.4 我的包是 "private": true, "devDependencies": { "express": "4.x", "grunt": "~0.4.1", "grunt-contrib-sass": "~0.3.0", "grunt-contrib-wat

我试图用沙斯和咕噜。我已经在我的路径中安装了ruby、sass和grunt。
版本是,

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

我的包是

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

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']);
}
现在,如果我尝试“咕噜”命令,我会得到下面的错误。有什么帮助吗

跑步:咕噜声或咕噜声观看或咕噜声sass

错误:

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安装compass
。在最初的示例中,您将grunt文件设置为使用compass,这将使您能够访问compass混合和功能

您的代码现在看起来不错,应该可以正常工作,但似乎找不到您的文件。当我靠近一台电脑时,我也会尝试一下

同时,您可以在sass任务上尝试
sourcemap:none
选项

更新:

对我来说非常好。您是否可以运行
tree-I node_modules
并发布输出(除非您认为有任何敏感信息),以便再次检查文件是否位于正确的位置

我希望它看起来像这样

.
├── Gruntfile.js
├── package.json
├── sass
│   └── style.scss
└── style
    ├── style.css
    └── style.css.map
第二次更新: 您的软件包似乎比我的新设置中的旧得多。请尝试从头开始,或执行以下操作:

安装npm检查更新

npm install npm-check-updates 
然后运行以下命令

  • npm检查更新
    将告诉您哪些软件包已过时
  • npm检查更新-u
    将更新您的
    包中的那些包。json
  • npm update
    更新所有过时的软件包
更新节点模块帮助

npm检查更新将告诉您哪些软件包已过时 npm检查更新-u将在您的package.json中更新这些包
npm更新更新您所有过时的软件包。

您好,谢谢您的回复。我还根据我的现状编辑了我的问题。但由于我是这个sass的初学者,grunt sass需要指南针吗?不管怎样,我刚刚安装了指南针,现在也尝试了。任何更新?似乎无法找到您的样式表文件。你做了吗?它们在正确的地方吗?用建议更新答案。当我在电脑前,我会试着运行你的例子。我尝试了“树-i节点_模块”。但它显示了一些错误,即“参数太多”。也许我指挥错了。无论如何,树结构是正确的。但还有一件事,我没有创建“style.css.map”。那是什么?它会自动生成还是我必须创建。唯一不同的是你的结构-我没有style.css.map。错了吗?不,这是由sass任务创建的,它允许您从浏览器检查未编译的源代码。这是一个非常好的特性,当您传入“sourcemap:none”时,它就会被停用。顺便说一句,你也试过了吗?这在现有答案(已经建议更新软件包)的基础上增加了什么?