Cordova浏览器错误

时间:2017-01-20 11:26:42

标签: cordova

我想测试cordova并构建一个简单的测试应用程序。 我按照https://cordova.apache.org/#getstarted

中的步骤进行操作

以下是一些输出(以前的输出没有错误):

C:\Users\jnq\Desktop\testCordova\TestLights>cordova platform add browser
Adding browser project...
Running command: cmd "/s /c "C:\Users\jnq\.cordova\lib\npm_cache\cordova-browser\4.1.0\package\bin\create.bat
C:\Users\jnq\Desktop\testCordova\TestLights\platforms\browser     io.cordova.hellocordova HelloCordova""
Creating Browser project. Path: platforms\browser
Error loading cordova-browser
Installing "cordova-plugin-whitelist" for browser

C:\Users\jnq\Desktop\testCordova\TestLights>cordova run browser
Error loading cordova-browser
Running command: cmd "/s /c "C:\Users\jnq\Desktop\testCordova\TestLights\platforms\browser\cordova\build.bat""
Cleaning Browser project
Running command: cmd "/s /c "C:\Users\jnq\Desktop\testCordova\TestLights\platforms\browser\cordova\run.bat --nobuild""
Static file server running @ http://localhost:8000/index.html
CTRL + C to shut down

我最终打开了一个错误的Chrome浏览器:ERR_CONNECTION_RESET

我跳过了什么吗? 如何使用cordova的浏览器平台?

谢谢, JNQ。

编辑:这是带有详细选项的add命令:

No scripts found for hook "before_platform_add".
No version supplied. Retrieving version from config.xml...
Adding browser project...
Failed to require PlatformApi instance for platform "browser". Using polyfill instead.
Running command: cmd "/s /c "C:\Users\jnq\.cordova\lib\npm_cache\cordova-browser\4.1.0\package\bin\create.bat C:\Users\jnq\Desktop\testCordova\TestLights\platforms\browser io.cordova.hellocordova HelloCordova""
Creating Browser project. Path: platforms\browser
Command finished with error code 0: cmd /s /c "C:\Users\jnq\.cordova\lib\npm_cache\cordova-browser\4.1.0\package\bin\create.bat C:\Users\jnq\Desktop\testCordova\TestLights\platforms\browser io.cordova.hellocordova HelloCordova"
Error loading cordova-browser
Checking for any plugins added to the project that have not been installed in browser platform
No differences found between plugins added to project and installed in browser platform. Continuing...
Generating config.xml from defaults for platform "browser"
Installing plugin "cordova-plugin-whitelist" following successful platform add of browser
Found variables for "cordova-plugin-whitelist". Processing as cli_variables.
Installing "cordova-plugin-whitelist" for browser
Running command: cmd "/s /c "C:\Users\jnq\Desktop\testCordova\TestLights\platforms\browser\cordova\version.bat""
Command finished with error code 0: cmd /s /c "C:\Users\jnq\Desktop\testCordova\TestLights\platforms\browser\cordova\version.bat"
Finding scripts for "before_plugin_install" hook from plugin cordova-plugin-whitelist on browser platform only.
No scripts found for hook "before_plugin_install".
Install start for "cordova-plugin-whitelist" on browser.
Beginning processing of action stack for browser project...
Action stack processing complete.
Install complete for cordova-plugin-whitelist on browser.
Finding scripts for "after_plugin_install" hook from plugin cordova-plugin-whitelist on browser platform only.
No scripts found for hook "after_plugin_install".
No scripts found for hook "before_prepare".
Checking config.xml for saved platforms that haven't been added to the project
Checking for any plugins added to the project that have not been installed in browser platform
No differences found between plugins added to project and installed in browser platform. Continuing...
Generating config.xml from defaults for platform "browser"
No scripts found for hook "after_prepare".
Checking config.xml for saved plugins that haven't been added to the project
Saving browser@4.1.0 into platforms.json
No scripts found for hook "after_platform_add".

运行命令的那个:

C:\Users\jnq\Desktop\testCordova\TestLights>cordova run browser --verbose
No scripts found for hook "before_run".
No scripts found for hook "before_prepare".
Checking config.xml for saved platforms that haven't been added to the project
Error loading cordova-browser
Checking for any plugins added to the project that have not been installed in browser platform
No differences found between plugins added to project and installed in browser platform. Continuing...
Generating config.xml from defaults for platform "browser"
No scripts found for hook "after_prepare".
Checking config.xml for saved plugins that haven't been added to the project
Running command: cmd "/s /c "C:\Users\jnq\Desktop\testCordova\TestLights\platforms\browser\cordova\build.bat""
Cleaning Browser project
Command finished with error code 0: cmd /s /c "C:\Users\jnq\Desktop\testCordova\TestLights\platforms\browser\cordova\build.bat"
No scripts found for hook "before_deploy".
Running command: cmd "/s /c "C:\Users\jnq\Desktop\testCordova\TestLights\platforms\browser\cordova\run.bat --nobuild""
Static file server running @ http://localhost:8000/index.html
CTRL + C to shut down

Edit2:显然我可以使用另一个端口然后使用8000来运行它。

1 个答案:

答案 0 :(得分:0)

如果在使用带有cordova的浏览器平台时遇到关于连接的错误,请尝试使用其他端口: cordova运行浏览器 - --port = 8080