0

sudo npm install -g karma除了安装所有必要的依赖项/预处理器之外,我还成功运行。

我的业力配置文件可以看到:

module.exports = function(config) {
config.set({
    rootElement: '#receiveQuote',
    browsers: ['PhantomJS'],
    frameworks: [
        'jasmine',
        'phantomjs-shim',
        'fixture'
    ],
    captureTimeout: 60000,
    reportSlowerThan: 1500,
    reporters: [
        'progress',
        'coverage'
    ],
    preprocessors: {
        '**/*.html': 'ng-html2js',
        '../app/**/*.html': 'ng-html2js',
        '**/*.json': 'json_fixtures',
        '../app/**/*.js': [
            'coverage'
        ]
    },
    files: [
        // bootstrap/dependencies
        '../vendor/assets/bower_components/jQuery/dist/jquery.min.js',
        '../vendor/assets/bower_components/lodash/lodash.min.js',
        '../app/assets/javascripts/application.js',
        '../app/assets/javascripts/bootstrap.min.js',
        '../vendor/assets/bower_components/angular/angular.js',
        '../vendor/assets/bower_components/angular-mocks/angular-mocks.js',
        '../vendor/assets/bower_components/angular-animate/angular-animate.js',
        '../vendor/assets/bower_components/angular-route/angular-route.js',
        '../vendor/assets/bower_components/angular-touch/angular-touch.js',
        '../vendor/assets/bower_components/angular-translate/angular-translate.js',
        '../vendor/assets/bower_components/ng-token-auth/dist/ng-token-auth.js',
        '../vendor/assets/bower_components/angular-messages/angular-messages.js',
        '../vendor/assets/bower_components/messageformat/messageformat.js',
        '../vendor/assets/bower_components/angular-translate-interpolation-messageformat/angular-translate-interpolation-messageformat.js',
        '../vendor/assets/bower_components/angular-aria/angular-aria.js',
        '../vendor/assets/bower_components/angular-placeholder-tai/lib/tai-placeholder.js',
        '../vendor/assets/bower_components/angular-sanitize/angular-sanitize.js',
        '../vendor/assets/bower_components/angular-bootstrap/ui-bootstrap-tpls.js',
        '../vendor/assets/bower_components/angular-ui-mask/dist/mask.js',
        '../vendor/assets/bower_components/moment/moment.js',
        '../vendor/assets/bower_components/sinonjs/sinon.js',
        '../vendor/assets/bower_components/angular-cookie/angular-cookie.js',
        // app src files
        '../app/assets/javascripts/main.js',
        '../app/assets/javascripts/**/*.js',
        //templates
        '../app/**/*.html',
        //test templates
        'tests/**/*.html',
        'tests/fixtures/**/*.json',
        //test files
        'spec_helper.js',
        'tests/**/*.js'
    ],
    exclude: [
        '../app/assets/javascripts/qe/**/*.js'
    ],
    ngHtml2JsPreprocessor: {
        stripPrefix: '.*app/assets/javascripts/'
    },
    jsonFixturesPreprocessor: {
        variableName: '__json__'
    },
    coverageReporter: {
        dir : 'coverage/',
        reporters: [
            { type: 'html', subdir: 'html' },
            { type: 'text', subdir: '.', file: 'report.txt' }
        ]
    }
});

};

当我运行时出现问题,sudo npm install -g karma-cli我收到错误:

Refusing to delete: /usr/bin/karma not in /usr/lib/node_modules/karma-cli  File exists: /usr/bin/karma
Move it away, and try again.

究竟是什么导致了这个问题?

4

1 回答 1

0

看起来 npm 想要删除一些文件作为安装的一个步骤,可能是为了删除旧版本,但它实际上并不希望它存在。作为预防措施,它似乎会阻止删除,以防文件与其他内容相关联。

我认为如果您自己删除它,或者可能使用 -f 标志运行安装以强制通过警告,您会没事的。

也许你或其他人在过去安装了业力。

于 2015-11-10T18:52:04.003 回答