我想测试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。
编辑:下面是带有verbose选项的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".和用于run命令的命令:
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 downEdit2:很明显,我可以让它在8000端口上运行。
发布于 2017-01-20 22:26:45
如果在cordova中使用浏览器平台时遇到连接错误,请尝试使用另一个端口: cordova run browser -port=8080
https://stackoverflow.com/questions/41762575
复制相似问题