簡體   English   中英

TypeError:無法在Class.run〜/ node_modules / angular-cli / tasks / serve.js:22:61處讀取null的屬性'config'

[英]TypeError: Cannot read property 'config' of null at Class.run ~/node_modules/angular-cli/tasks/serve.js:22:61

我在產品包裝盒上不斷收到此錯誤,我所做的所有搜索都表明該錯誤是由於缺少angular.json文件引起的,但我並沒有在我的項目根目錄中丟失該文件!

當我運行npm start,npm build,npm test等時,我又得到了同樣的錯誤。

當我將存儲庫克隆到產品包裝盒上時,我進入了文件夾,然后執行了“ npm install”,這應該已經安裝了所有依賴項,但是我無法在我的產品包裝盒上得到這個錯誤,所以我不確定與生產將導致此錯誤的開發服務器。

dtadmin@my-prod-server:~/portal$ npm test

> ng-crud-table@0.0.0 test /home/portal
> ng test

As a forewarning, we are moving the CLI npm package to "@angular/cli" with the next release,
which will only support Node 6.9 and greater. This package will be officially deprecated
shortly after.

To disable this warning use "ng set --global warnings.packageDeprecation=false".

Cannot read property 'config' of null
TypeError: Cannot read property 'config' of null
    at /home/portal/node_modules/angular-cli/tasks/test.js:12:77
    at new Promise (<anonymous>)
    at Class.run (/home/portal/node_modules/angular-cli/tasks/test.js:10:16)
    at Class.run (/home/portal/node_modules/angular-cli/commands/test.js:29:25)
    at Class.<anonymous> (/home/portal/node_modules/angular-cli/ember-cli/lib/models/command.js:134:17)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
npm ERR! Test failed.  See above for more details.

這是我要求的test.js文件:


"use strict";
var Task = require('../ember-cli/lib/models/task');
var path = require('path');
var require_project_module_1 = require('../utilities/require-project-module');
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Task.extend({
    run: function (options) {
        var _this = this;
        var projectRoot = this.project.root;
        return new Promise(function (resolve) {
            var karma = require_project_module_1.requireDependency(projectRoot, 'karma');
            var karmaConfig = path.join(projectRoot, _this.project.ngConfig.config.test.karma.config);
            var karmaOptions = Object.assign({}, options);
            // Convert browsers from a string to an array
            if (options.browsers) {
                karmaOptions.browsers = options.browsers.split(',');
            }
            karmaOptions.angularCli = {
                codeCoverage: options.codeCoverage,
                sourcemap: options.sourcemap,
                progress: options.progress
            };
            // Assign additional karmaConfig options to the local ngapp config
            karmaOptions.configFile = karmaConfig;
            // :shipit:
            var karmaServer = new karma.Server(karmaOptions, resolve);
            karmaServer.start();
        });
    }
});
//# sourceMappingURL=/Users/hans/Sources/angular-cli/packages/angular-cli/tasks/test.js.map

以某種方式將其添加到我的package.json文件中:

"angular-cli": "^1.0.0-beta.28.3",

我的朋友認為腳本可能會無意中這樣做,但這就是導致錯誤的原因。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM