[英]Angular CLI and angular 4 not work ng serve
當我上菜時我得到這個結果
angular\router\@angular\router.es5.jsError: No module factory available for dependency type: ContextElementDependency
at Compilation.addModuleDependencies
node_modules\@angular\cli\node_modules\webpack\lib\Compilation.js:264
if(_this.profile) {
^
TypeError: Cannot read property 'profile' of null
at factoryCallback
角度cli
“ dependencies”:{“ @ angular / animations”:“ ^ 4.0.1”,“ @ angular / common”:“ ^ 4.0.0”,...
我遇到了同樣的問題,並通過執行以下步驟解決了這個問題:1-從package.json中刪除webpack 2-刪除node_modules文件夾3-使用以下命令全局安裝webpack:npm install webpack -g npm install webpack-dev-server -g 4-運行npm安裝
注意:如果(npm start)生成錯誤,請嘗試刪除(package-lock.json),刪除node_modules,然后再次運行“ npm install”
當角度4消失時,使用ng new
生成新的角度項目,如角度cli的更改日志中所述,然后嘗試
https://github.com/angular/angular-cli/blob/master/CHANGELOG.md
否則您必須更新您的angular cli https://github.com/angular/angular-cli#updating-angular-cli
根據您的評論,
在另一台計算機上,通過使用安裝Angular-CLI
npm install angular-cli -g
然后嘗試通過ng serve
運行您的應用
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.