我正在关注教程:https://www.ibm.com/developerworks/library/mo-android-mobiledata-app/index.html
当应用程序启动时,它会立即被阻止并停止运行。
在活动信息频道中显示以下信息:
该应用程序的一个实例已被阻止:发生了2个错误:*发生了2个错误:*退出了stat ...
我默认离开了一切,我尝试了不同的地区(美国南部,英国,......),行为是一样的......
我不知道问题是什么。
此致
答案 0 :(得分:1)
我能够重现这个问题。我在日志中得到的错误是:
2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR /home/vcap/app/node_modules/loopback/node_modules/strong-globalize/node_modules/os-locale/index.js:2
2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR const execa = require('execa');
2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR ^^^^^
2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR SyntaxError: Use of const in strict mode.
2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR at exports.runInThisContext (vm.js:73:16)
2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR at Module._compile (module.js:443:25)
2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR at Object.Module._extensions..js (module.js:478:10)
2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR at Module.load (module.js:355:32)
2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR at Function.Module._load (module.js:310:12)
2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR at Module.require (module.js:365:17)
2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR at require (module.js:384:17)
2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR at Object.<anonymous> (/home/vcap/app/node_modules/loopback/node_modules/strong-globalize/lib/globalize.js:13:16)
2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR at Module._compile (module.js:460:26)
2017-11-09T12:06:31.13-0600 [APP/PROC/WEB/0] ERR at Object.Module._extensions..js (module.js:478:10)
2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! Linux 4.4.0-75-generic
2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! argv "/home/vcap/app/vendor/node/bin/node" "/home/vcap/app/vendor/node/bin/npm" "start"
2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! node v0.12.18
2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! npm v2.15.11
2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! code ELIFECYCLE
2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! HelloTodo@1.0.0 start: `node .`
2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! Exit status 1
2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR!
2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! Failed at the HelloTodo@1.0.0 start script 'node .'.
2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! This is most likely a problem with the HelloTodo package,
2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! not with npm itself.
2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! Tell the author that this fails on your system:
2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! node .
2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! You can get information on how to open an issue for this project with:
2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! npm bugs HelloTodo
2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! Or if that isn't available, you can get their info via:
2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR!
2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! npm owner ls HelloTodo
2017-11-09T12:06:31.18-0600 [APP/PROC/WEB/0] ERR npm ERR! There is likely additional logging output above.
2017-11-09T12:06:31.21-0600 [APP/PROC/WEB/0] ERR npm ERR! Please include the following file with any support request:
2017-11-09T12:06:31.21-0600 [APP/PROC/WEB/0] ERR npm ERR! /home/vcap/app/npm-debug.log
这是错误,因为在Node.js 0.12中默认情况下未启用ES6。正如@pradeep sg所说,那篇博文和初学者已经过时了。如果您查看启动器的代码,它会在 package.json 中指定节点版本0.12。
https://github.com/ibm-bluemix-mobile-services/bms-hellotodo-strongloop
要为您的本地环境修复此问题,请下载入门代码,然后按如下所示修改 package.json :
{
"name": "HelloTodo",
"description": "A simple todo list application created with StringLoop, LoopBack and Bluemix Mobile Services",
"version": "1.0.0",
"main": "server/server.js",
"scripts": {
"start": "node ."
},
"author": "Anton Aleksandrov",
"dependencies": {
"bluemix-appid": "1.x",
"compression": "^1.0.3",
"cors": "^2.5.2",
"loopback": "^2.22.0",
"loopback-boot": "^2.6.5",
"loopback-component-explorer": "^2.1.0",
"loopback-connector-mysql": "^2.2.0",
"loopback-datasource-juggler": "^2.39.0",
"passport": "^0.3.2",
"serve-favicon": "^2.0.1"
},
"repository": {
"type": "git",
"url": "https://github.com/ibm-bluemix-mobile-services/bms-hellotodo-strongloop.git"
},
"engines": {
"node": "8.9.x"
},
"license": "Apache-2.0"
然后执行bx cf push
重新部署,因此它使用较新的Node引擎。
在我这样做之后,它起作用了:
如果您想查找移动团队制作的最新内容,请在Bluemix上查看他们的信息中心:
https://console.bluemix.net/developer/mobile/dashboard
这将提供他们即将发布的最新入门套件,演示,博客和内容。
我会就此问题通知他们,以便部署正常运行。