2017-07-18 165 views
2

我從網上下載angular.io一個例子項目,從這裏 https://angular.io/generated/zips/cli-quickstart/cli-quickstart.zip爲什麼我在node_modules中有@ angular/core,但仍然出現這個錯誤?

就跑在根文件夾故宮安裝,如在本教程中

https://www.youtube.com/watch?v=bJKejcQJqHE

和somewhy,雖然我已經對應在node_modules和package.json中的角度包,我仍然得到這個:

Hash: faeff28da7a6ba00851d      
Time: 8547ms 
chunk {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 171 kB {4} [initial] [rendered] 
chunk {1} main.bundle.js, main.bundle.js.map (main) 5.41 kB {3} [initial] [rendered] 
chunk {2} styles.bundle.js, styles.bundle.js.map (styles) 11.5 kB {4} [initial] [rendered] 
chunk {3} vendor.bundle.js, vendor.bundle.js.map (vendor) 2.18 MB [initial] [rendered] 
chunk {4} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered] 

ERROR in /home/ivan/anglr-lrn/src/app/app.component.ts (1,27): Cannot find module '@angular/core'. 

ERROR in /home/ivan/anglr-lrn/src/app/app.component.ts (8,14): Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning. 

ERROR in /home/ivan/anglr-lrn/src/app/app.module.ts (1,31): Cannot find module '@angular/platform-browser'. 

ERROR in /home/ivan/anglr-lrn/src/app/app.module.ts (2,26): Cannot find module '@angular/core'. 

ERROR in /home/ivan/anglr-lrn/src/app/app.module.ts (16,14): Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning. 

ERROR in /home/ivan/anglr-lrn/src/main.ts (1,32): Cannot find module '@angular/core'. 

ERROR in /home/ivan/anglr-lrn/src/main.ts (2,40): Cannot find module '@angular/platform-browser-dynamic'. 

ERROR in Could not resolve module @angular/core 
webpack: Failed to compile. 
webpack: Compiling... 
Hash: faeff28da7a6ba00851d            
Time: 807ms 
chunk {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 171 kB {4} [initial] 
chunk {1} main.bundle.js, main.bundle.js.map (main) 5.41 kB {3} [initial] 
chunk {2} styles.bundle.js, styles.bundle.js.map (styles) 11.5 kB {4} [initial] 
chunk {3} vendor.bundle.js, vendor.bundle.js.map (vendor) 2.18 MB [initial] 
chunk {4} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] 

ERROR in /home/ivan/anglr-lrn/src/app/app.component.ts (1,27): Cannot find module '@angular/core'. 

ERROR in /home/ivan/anglr-lrn/src/app/app.component.ts (8,14): Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning. 

ERROR in /home/ivan/anglr-lrn/src/app/app.module.ts (1,31): Cannot find module '@angular/platform-browser'. 

ERROR in /home/ivan/anglr-lrn/src/app/app.module.ts (2,26): Cannot find module '@angular/core'. 

ERROR in /home/ivan/anglr-lrn/src/app/app.module.ts (16,14): Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning. 

ERROR in /home/ivan/anglr-lrn/src/main.ts (1,32): Cannot find module '@angular/core'. 

ERROR in /home/ivan/anglr-lrn/src/main.ts (2,40): Cannot find module '@angular/platform-browser-dynamic'. 
webpack: Failed to compile. 
+0

您需要發佈你的代碼。沒有人會觀看該視頻來幫助你。你的解決方案中包含哪些文件? – peinearydevelopment

回答

1

這工作在類似的情況:

卸載您計算機上的NodeJS

如果與可下載的安裝程序包安裝 - (添加或刪除程序>選擇和的NodeJS點擊卸載)

下載並安裝6.10.3的NodeJS(https://nodejs.org/dist/v6.10.3/node-v6.10.3-x64.msi

清理node_modules文件夾

rm -rf node_modules/

清理任何臨時文件夾

運行這些命令

npm uninstall -g angular-cli 
npm cache clean 
npm install -g @angular/cli 
npm install 
相關問題