将我的Angular项目从本地计算机复制到我的Linux服务器之后,我尝试使用ng serve
运行项目,但它没有用。相反,它在控制台的编辑器中打开了一个新文件。
然后我研究并提出了npm start
。但是,那也行不通。给我以下错误。
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
文件。它并没有丢失。
这可能是什么原因?任何解决方案。?
答案 0 :(得分:0)
You may have to install angular cli on your linux server if you want to run it this way.
npm install @angular/cli -g
However, you may want to build your project for production if you want to serve it. Build it locally and push the built 'dist' folder to your server:
npm run ng build -prod
答案 1 :(得分:0)
Try this
npm install -g @angular/cli