2016-11-18 108 views
1

我剛剛創建一個新項目ionic start blank --v2和我給了ionic serve。在我瀏覽我收到錯誤,如下面錯誤:ENOENT:沒有這樣的文件或目錄,打開在ionic2

Error: ENOENT: no such file or directory, open '/home/panini/myApp/www/index.html'.

這是我在cmd

Running live reload server: http://localhost:35729 
Watching: www/**/*, !www/lib/**/*, !www/**/*.map 
√ Running dev server: http://localhost:8100 
Ionic server commands, enter: 
    restart or r to restart the client app from the root 
    goto or g and a url to have the app navigate to the given url 
    consolelogs or c to enable/disable console log output 
    serverlogs or s to enable/disable server log output 
    quit or q to shutdown the server and exit 

ionic $ 

我不覺得輸出ionic serve在我離子任何一飲而盡文件腕錶服務

這裏是我的包.json文件

{ 
    "name": "ionic-hello-world", 
    "author": "Ionic Framework", 
    "homepage": "http://ionicframework.com/", 
    "private": true, 
    "scripts": { 
    "ionic:build": "ionic-app-scripts build", 
    "ionic:serve": "ionic-app-scripts serve" 
    }, 
    "dependencies": { 
    "@angular/common": "2.1.1", 
    "@angular/compiler": "2.1.1", 
    "@angular/compiler-cli": "2.1.1", 
    "@angular/core": "2.1.1", 
    "@angular/forms": "2.1.1", 
    "@angular/http": "2.1.1", 
    "@angular/platform-browser": "2.1.1", 
    "@angular/platform-browser-dynamic": "2.1.1", 
    "@angular/platform-server": "2.1.1", 
    "@ionic/storage": "1.1.6", 
    "ionic-angular": "2.0.0-rc.2", 
    "ionic-native": "2.2.3", 
    "ionicons": "3.0.0", 
    "rxjs": "5.0.0-beta.12", 
    "zone.js": "0.6.21" 
    }, 
    "devDependencies": { 
    "@ionic/app-scripts": "0.0.43", 
    "typescript": "2.0.6" 
    }, 
    "description": "myApp: An Ionic project", 
    "cordovaPlugins": [ 
    "cordova-plugin-device", 
    "cordova-plugin-console", 
    "cordova-plugin-whitelist", 
    "cordova-plugin-splashscreen", 
    "cordova-plugin-statusbar", 
    "ionic-plugin-keyboard" 
    ], 
    "cordovaPlatforms": [] 
} 

這是我的離子信息結果

Your system information: 

Cordova CLI: 6.3.0 
Ionic Framework Version: 2.0.0-rc.2 
Ionic CLI Version: 2.1.0 
Ionic App Lib Version: 2.1.0-beta.1 
OS: Distributor ID: Ubuntu Description: Ubuntu 16.04.1 LTS 
Node Version: v6.0.0 

注意

根據在此的package.json討論https://github.com/driftyco/ionic-cli/issues/1420我的腳本對象時,我在下面的對象與此更新,它正在不匹配

"scripts": { 
"build": "ionic-app-scripts build", 
"watch": "ionic-app-scripts watch", 
"serve:before": "watch", 
"emulate:before": "build", 
"deploy:before": "build", 
"build:before": "build", 
"run:before": "build" 
} 

問題:

On giving ionic start myApp blank --v2 i am not able to generate package.json correctly.

http://blog.ionic.io/improvements-to-ionic-build-process/ according to this blog i tried still no better output.

回答

3

我使用的是ubuntu16.04,我忘了添加sudo命令befor,這是我的問題,同時安裝到最新的一個。

sudo npm install -g [email protected] 
sudo npm install @ionic/[email protected] 

現在一切正常

0

我遇到了完全相同的問題。我更新的離子,以反映這一

CMD離子信息

Cordova CLI: 6.4.0 
Ionic CLI Version: 2.1.12 
Ionic App Lib Version: 2.1.7 
ios-deploy version: 1.9.0 
ios-sim version: 5.0.11 
OS: macOS Sierra 
Node Version: v6.9.1 
Xcode version: Xcode 8.1 Build version 8B62 

註釋節點版本是不是7.0

啓動一個新項目sidemenu標籤和離子-l或離子服務應該管用。

0

我也面臨着同樣的問題,我在這裏搜索離子論壇
https://github.com/ionic-team/ionic-cli/issues/1420 最後我來到意識到那我必須做一些像這個 -

我在這裏缺少index.html文件 -
www/index.html
我只是複製並粘貼索引文件來解決這個問題
拷貝形式src/index.html
貼在這裏www/index.html

希望這將對於你,因爲這爲我工作。

OR

另一種方法做的,如果你得到節點兼容的錯誤,而安裝科爾多瓦那麼下面這篇文章
http://ionicframework.com/docs/intro/installation/

只是更新本地的設置只是做它 -

$ sudo npm install n -g 

安裝n來管理節點版本。

$ sudo n latest 

安裝最新版本的節點。

$ npm install -g ionic cordova 

安裝科爾多瓦。
立即創建新的APP-

$ ionic start cutePuppyPics 

運行服務器 -

$ cd cutePuppyPics 
$ ionic serve 

希望這將有助於太...

相關問題