ionic2在寻址到正在运行的开发服务器(Ionic Hello World)期间失败



ionic2 hello world 不起作用。

我正在官方网站上关注入门 - https://ionicframework.com/docs/v2/intro/tutorial/

install cordova and ionic
ionic start probaionic --v2
cd probaionic
ionic serve

一切正常 - 开发服务器正在运行:http://localhost:8100/

当我尝试寻址此 URL 时,出现此错误:

traineeProgram/probaionic/node_modules/@ionic/app-scripts/dist/dev-server      /live-reload.js:27
var contentStr = content.toString();
                        ^
TypeError: Cannot read property 'toString' of undefined
at Object.injectLiveReloadScript (/media/volodymyr/Media/[[1]] work/[8]programming/[1]keenethics/traineeProgram/probaionic/node_modules/@ionic/app-scripts/dist/dev-server/live-reload.js:27:29)
at ReadFileContext.callback (/media/volodymyr/Media/[[1]] work/[8]programming/[1]keenethics/traineeProgram/probaionic/node_modules/@ionic/app-scripts/dist/dev-server/http-server.js:62:39)
at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:365:13)
npm ERR! Linux 4.4.0-57-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "ionic:serve" "--" "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"
npm ERR! node v6.9.5
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! ionic-hello-world@ ionic:serve: `ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ionic-hello-world@ ionic:serve script 'ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"'.
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 serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"
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.

我在以下警告中遇到了同样的问题

******************************************************屬地警告 - 为了使 CLI 正常运行,强烈建议安装/升级以下内容:请将您的科尔多瓦 CLI 安装到版本>=4.2.0 npm install -g cordova 安装 ios-sim 以部署 iOS应用。npm install -g ios-sim (可能需要 sudo( 安装ios-deploy 将 iOS 应用程序部署到设备。npm install -gios-deploy (可能需要 sudo(

<小时 />

尝试,运行cordova -v命令,您将被以下问题选中

? May Cordova anonymously report usage statistics to improve the tool over time? No

我使用了no,它显示版本是6.5.0

You have been opted out of telemetry. To change this, run: cordova telemetry on. 6.5.0

我再次运行ionic serve命令,它起作用了。

相关内容

  • 没有找到相关文章

最新更新