TypeError:无法读取null的属性'config' [英] TypeError: Cannot read property 'config' of null

查看:470
本文介绍了TypeError:无法读取null的属性'config'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将我的Angular项目从本地计算机复制到我的Linux服务器之后,我尝试使用 ng serve 运行该项目,但它无效。相反,它在控制台的编辑器中打开了一个新文件。

After copied my Angular project from my local computer to my Linux server, I tried to run the project using ng serve and it didn't work. Instead it opened a new file in an editor in the console.

然后我研究并提出了 npm start 。但是,那也行不通。给我以下错误。

Then I researched and came up with npm start. However, that also not working. Gives me the following error.

Cannot read property 'config' of null
TypeError: Cannot read property 'config' of null
    at Class.run (/var/www/html/node1/social2/client/node_modules/angular-cli/tasks/serve.js:22:61)
    at /var/www/html/node1/social2/client/node_modules/angular-cli/commands/serve.run.js:22:22
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! client@0.0.0 start: `start http://xxx.xx.xx.xx:4200 & ng serve -port 4200`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client@0.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-01-23T18_49_07_743Z-debug.log

我有 .angular-cli.json 文件也在那里。它并没有丢失。

And I have the .angular-cli.json file also there. It's not missing.

这可能是什么原因?任何解决方案。?

What could be the reason for this ? And any solution.?

推荐答案

试试这个

npm install - g @ angular / cli

npm install -g @angular/cli

这篇关于TypeError:无法读取null的属性'config'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆