指南针失败 Post 迁移到 'El Capitan'

Compass Fails Post Migration to 'El Capitan'

我对 grunt 比较陌生,但我很喜欢它,但是在搬到 'el capitan' 之后,我对 compass 没有成功感到非常沮丧。在 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'。

我通过卸载所有 binaries/gems(包括 ruby)并将路径从 /usr/bin 更新为 /usr/local/bin 来解决此问题。根据您的原始 OS 等,您的路径可以在各种隐藏文件中。更新路径后,重新安装您的二进制文件,以便从 /usr/local/bin 安装 运行。尝试使用以下终端命令找到您的 binaries/active ruby:

gem e
ruby version