2016-07-15 23 views
0

我是AngularJS的新手。我正在安裝AngularJS並卡在以下步驟:無法使用grunt構建AngularJS

咕嚕包。

錯誤如下:

Loading "Gruntfile.js" tasks...ERROR 
>> Error: Unable to read CDN version, are you offline or has the CDN not been properly pushed? 
>>  at Object.module.exports (D:\angular.js\Gruntfile.js:21:11) 
>>  at loadTask (D:\angular.js\node_modules\grunt\lib\grunt\task.js:325:10) 
>>  at Task.task.init (D:\angular.js\node_modules\grunt\lib\grunt\task.js:437:5) 
>>  at Object.grunt.tasks (D:\angular.js\node_modules\grunt\lib\grunt.js:120:8) 
>>  at Object.module.exports [as cli] (D:\angular.js\node_modules\grunt\lib\grunt\cli.js:38:9) 
>>  at Object.<anonymous> (C:\Users\rnaguban\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt:44:20) 
>>  at Module._compile (module.js:409:26) 
>>  at Object.Module._extensions..js (module.js:416:10) 
>>  at Module.load (module.js:343:32) 
>>  at Function.Module._load (module.js:300:12) 
>>  at Function.Module.runMain (module.js:441:10) 
>>  at startup (node.js:139:18) 
>>  at node.js:968:3 

Running tasks: package 
Warning: Task "package" not found. Use --force to continue. 

Aborted due to warnings. 

任何輸入將是有益的。

感謝 拉維

+0

您是否連接到互聯網? 「無法讀取CDN版本,你是否離線」 – Raghuveer

+0

你可能不應該依賴CDN進行本地開發,也可以選擇'Task'包未找到' –

+0

@Raghuveer我已連接到互聯網 –

回答

1

我也遇到了這個問題,像這樣:

CDN version (remote): No version found. Current version (remote): v1.5.7 Loading "Gruntfile.js" tasks...ERROR 
>> Error: Unable to read CDN version, are you offline or has the CDN not been properly pushed? Warning: Task "package" not found. Use 
--force to continue. 

Aborted due to warnings. 

我檢查了角的源代碼,在 'Gruntfile.js' 發現,line20它扔錯誤

無法讀取CDN版本,您是離線還是CDN未正確推送?

,所以評論此代碼來解決您的問題。

//if (versionInfo.cdnVersion == null) { 
    // throw new Error('Unable to read CDN version, are you offline or has the CDN not been properly pushed?'); 
    //} 

這可以使建築成功。

enter image description here

3

你應該先設置環境變量NG1_BUILD_NO_REMOTE_VERSION_REQUESTS。例如,在Windows中:

set NG1_BUILD_NO_REMOTE_VERSION_REQUESTS=1