0

我对 grunt 很陌生并且很喜欢它,但是在搬到 'el capitan' 之后,我对指南针缺乏成功感到非常沮丧。在 grunt 项目目录中,运行“grunt”有一个 EPERM 错误,似乎表明 sass/scss 无法使用 compass/watch 组合进行编译:

sh-3.2# grunt
Running "compass:dev" (compass) task
unchanged img/common/1x-scb9effd9a6.png
unchanged img/common/2x-sd9683d03fa.png
Errno::EPERM on line ["512"] of /Library/Ruby/Gems/2.0.0/gems/sass-3.4.19/lib/sass/plugin/compiler.rb: Operation not permitted - /Applications/MAMP/htdocs/Repos/dev/wp-content/themes/quindodo/_/css/giving.css
Run with --trace to see the full backtrace
Warning: ↑ Use --force to continue.

Grunt 文件如下:

module.exports = function(grunt) {

//All configuration goes here
grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    compass: {
        dev: {
            options: {              
                sassDir: 'sass',
                cssDir: 'css',
                fontsDir: 'fonts',
                imagesDir: 'img',
                images: 'img',
                javascriptsDir: 'js/pro',
                //environment: 'development',
                outputStyle: 'compressed',
                relativeAssets: false,
                httpPath: '.',
            }
        },
    },

    watch: {
            compass: {
            files: ['*.{scss,sass}'],
            tasks: ['compass:dev'],
        }

    },
});
// Where we tell Grunt we plan to use this plug-in.
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-watch');

// Where we tell Grunt what to do when we type "grunt" into the terminal.
grunt.registerTask('default',['compass','watch']);
};

最后,我的 package.json

 {
"name": "quindido",
"version": "0.0.0",
"description": "Quindodo Theme CSS",
"private": true,
"devDependencies": {
 "grunt": "~0.4.5",
 "grunt-contrib-jshint": ">=0.10.0",
 "grunt-contrib-nodeunit": ">=0.4.1",
 "grunt-contrib-sass": ">0.0.1",
 "grunt-contrib-watch": ">0.0.1"
  }
 }

我将非常感谢您的解决方案。我尝试禁用 CIP。我还尝试了“sudo gem install -n /usr/local/bin compass”以及“gem update --system”。我想我已经成功卸载并重新安装了 npm 和模块。我也刚刚尝试从 devDependencies 中删除“grunt-contrib-compass”。

4

1 回答 1

0

我通过卸载所有二进制文件/gems(包括 ruby​​)并更新从 /usr/bin 到 /usr/local/bin 的路径解决了这个问题。根据您的原始操作系统等,您的路径可能位于各种隐藏文件中。更新路径后,重新安装二进制文件,以便从 /usr/local/bin 安装和运行它们。尝试使用以下终端命令来定位您的二进制文件/活动 ruby​​:

gem e
ruby version
于 2016-01-08T15:47:41.920 回答