gpt4 book ai didi

javascript - 类型错误 : Cannot read property 'config' of null at Class. 运行〜/node_modules/angular-cli/tasks/serve.js:22:61

转载 作者:太空宇宙 更新时间:2023-11-04 01:35:18 25 4
gpt4 key购买 nike

我的产品盒上不断出现此错误,我所做的所有搜索都表明此错误是由于缺少 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",

我的 friend 认为脚本可能无意中执行了此操作,但这就是导致错误的原因。

关于javascript - 类型错误 : Cannot read property 'config' of null at Class. 运行〜/node_modules/angular-cli/tasks/serve.js:22:61,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54772256/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com