我刚刚创建了一个新项目ionic start blank --v2
,我给了ionic serve
。在我的浏览中,我收到如下错误
错误:ENOENT:没有此类文件或目录,请打开' /home/panini/myApp/www/index.html'。
这是ionic serve
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 $
我在离子服务器中找不到任何gulp文件监视
这是我的package.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
注意
根据这个https://github.com/driftyco/ionic-cli/issues/1420讨论,当我使用下面这个对象进行更新时,package.json中的脚本对象不匹配
"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"
}
问题:
在给予离子启动myApp空白时--v2我无法正确生成package.json。
http://blog.ionic.io/improvements-to-ionic-build-process/根据这个博客我尝试过没有更好的输出。
答案 0 :(得分:4)
我使用的是ubuntu16.04,我忘记在安装到最新版本时添加了sudo命令,这是我的问题。
sudo npm install -g ionic@latest
sudo npm install @ionic/app-scripts@latest
现在一切正常
答案 1 :(得分: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或离子服务应该有效。
答案 2 :(得分: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/
如果您在安装cordova时遇到节点兼容性错误,那么就这样做 -
$ sudo npm install n -g
安装n以管理节点版本。
$ sudo n latest
安装最新版本的节点。
$ npm install -g ionic cordova
安装cordova。
现在创建新的应用程序 -
$ ionic start cutePuppyPics
运行server-
$ cd cutePuppyPics
$ ionic serve
希望它也会有所帮助......