2016-10-04 82 views
3

我剛剛創建了一個新的Ionic 2 rc0應用程序,昨晚我能夠運行它。如果我創建一個新的應用程序離子服務器無法使用Ionic 2 rc0應用程序

Running 'serve:before' npm script before serve 
> [email protected] watch J:\ionic projects\newionicapp 
> ionic-app-scripts watch 
module.js:457 
    throw err; 
    ^

Error: Cannot find module '../dist/index' 
    at Function.Module._resolveFilename (module.js:455:15) 
    at Function.Module._load (module.js:403:25) 
    at Module.require (module.js:483:17) 
    at require (internal/module.js:20:19) 
    at Object.<anonymous> (J:\ionic projects\newionicapp\node_modules\@ionic\app-scripts\bin\ionic-app-scripts.js:19:3) 
    at Module._compile (module.js:556:32) 
    at Object.Module._extensions..js (module.js:565:10) 
    at Module.load (module.js:473:32) 
    at tryModuleLoad (module.js:432:12) 
    at Function.Module._load (module.js:424:3) 



npm 
ERR! Windows_NT 10.0.10586 
npm ERR! argv "J:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\rosst\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "watch" 
npm ERR! node v6.7.0 
npm ERR! npm v3.10.8 
npm ERR! code ELIFECYCLE 
npm ERR! [email protected] watch: `ionic-app-scripts watch` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] watch script 'ionic-app-scripts watch'. 
npm ERR! Make sure you have the latest version of node.js and npm installed. 
npm ERR! If you do, this is most likely a problem with the ionic-hello-world package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  ionic-app-scripts watch 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs ionic-hello-world 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR!  npm owner ls ionic-hello-world 
npm 
ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR!  J:\rosst\ionic projects\newionicapp\npm-debug.log 

Caught exception: 
undefined 

Mind letting us know? https://github.com/driftyco/ionic-cli/issues 

,它運行良好:

然而,把電腦,而離子的發球運行睡覺,試圖結束今天離子後,啓動應用程序後,發球得到這個錯誤。所以我認爲我的項目裏面爆發了一些東西但我不知道是什麼。

+1

不確定爲什麼有人投下了這個問題,所以在投票時應該有一些選項可以添加評論。 :)。 Coz這是下來投票下主題,但問題似乎合法我 – sameera207

+0

你也可以嘗試刪除整個'node-modules'文件夾,然後再次運行'npm install' ... – sebaferreras

+1

@sebaferreras這工作對我來說包括刪除'.tmp'文件夾。 – Ivaro18

回答

10

刪除您的node_modules文件夾然後運行npm install重新安裝所有模塊。這將確保所有節點模塊都乾淨。

還刪除您的www文件夾中的內容,然後運行離線服務重新生成文件。這將確保您的項目構建清潔。

如果這不起作用,請嘗試通過運行npm install -g [email protected]將您的ionic-cli更新爲最新版本,然後再次嘗試上述操作。

Ionic CLI使用不是特定目標版本的ionic-app-scripts版本。離子應用腳本已更新,儘管離子應用腳本尚未更新,但它現在使用更新版本的離子應用腳本,這對我造成了一些問題。

祝你好運!

0

我發現有點類似error,它看起來像它與更新npm有關。

所以嘗試更新npm到最新。 read here關於步驟升級。 PS:但是這並不能解釋爲什麼它適用於新項目。 :)

7

嘗試更新離子應用程序腳本。

npm i @ionic/app-scripts

它爲我工作。

+0

這對我有用!謝謝! – makinbacon

3

我有同樣的問題,我研究了很多,找到一個解決辦法試試你的終端上運行此命令 -

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p 
0

我有這個問題了很多東西。 我搜索互聯網,並嘗試了所有可能的解決方案,沒有運氣。

我終於發現,從應用程序名稱中刪除空格使所有的工作。因此,刪除所有內容的det app文件夾,並創建一個名稱中沒有空格的新文件夾。

無論如何,這對我來說很有效。

+0

看來問題中的問題不是多餘的空格 – yass