运行"sass:dist" (sass) 任务 Errno::ENOENT:没有这样的文件或目录 @ rb_sysopen - 未定义



我试图创建一个gruntfile,它将编译我所有的脚本、css和html文件(就像大多数grunt文件一样),我输入了一些命令让sass编译并放入一个单独的文件夹中。我点击'Grunt',它输出错误:

Running "sass:dist" (sass) task
Errno::ENOENT: No such file or directory @ rb_sysopen - undefined

在gruntfile.js中调用我的sass的部分如下:

配置任务
sass: {
  dist: {
    files: [{
      expand: false,
      cwd: 'styles',
      src: [ '**/*.scss' ],
      dest: 'build',
      ext: '.css'
    }]
  }
},

注册任务

});
grunt.registerTask(
  'scripts',
  'compiles the Javascript files.',
  [ 'coffee', 'uglify', 'clean:scripts' ]
);
grunt.registerTask(
  'stylesheets',
  'compiles the stylesheets.',
  [ 'autoprefixer', 'cssmin', 'sass', 'clean:stylesheets' ]
);
grunt.registerTask(
  'build',
  'Compiles all of the assets and copies the files to the build directory.',
  [ 'clean:build', 'copy', 'stylesheets', 'sass', 'scripts', 'jade' ]
);
grunt.registerTask(
  'default',
  'Watches the project for changes, automatically builds them and runs a server.',
  [ 'build', 'connect', 'watch' ]
);

加载任务

grunt.loadNpmTasks('grunt-contrib-sass');

我也有同样的错误。根本原因是sass> dist>文件配置不正确。

降级至0.4。X表示实际误差。一旦我修复了配置,我就升级回最新的grunt-contrib-sass版本,它工作正常。

我将grunt-contrib-sass降级为0.4。X,算出来了。谢谢你的帮助。

最新更新