- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我最近在 IBM blumix 上开始了我的第一个 NodeJs 应用程序,遵循这些教程 http://ibm-bluemix.coderpower.com/#/warmup/55e07bf49924f792327901cd/code 。我按照说明进行操作,但是当我启动应用程序时,出现错误 Cannot find module 'ibmbluemix'
我的代码和教程一样,我几乎感觉ibm bluemix模块没有安装在云ibm bluemix上。
这是代码包.json
{
"name": "NodejsStarterApp",
"version": "0.0.1",
"description": "A sample nodejs app for Bluemix",
"scripts": {
"start": "node app.js"
},
"dependencies": {
"express": "4.12.x",
"cfenv": "1.0.x"
},
"repository": {},
"engines": {
"node": "0.12.x"
}
}
app.js
var express = require('express');
var ibmbluemix = require('ibmbluemix');
var config = {
applicationId:"FirstAppli",
applicationRoute:"firstappli.mybluemix.net"
};
// cfenv provides access to your Cloud Foundry environment
// for more info, see: https://www.npmjs.com/package/cfenv
var cfenv = require('cfenv');
// create a new express server
var app = express();
// serve the files out of ./public as our main files
app.use(express.static(__dirname + '/public'));
var router = express.Router();
router.get('/', /* @callback */ function(req,res){
ibmbluemix.initialize(config).then(/* @callback */ function(success) {
res.json({ message : 'sdk initialised' });
},
/* @callback */ function(err){
res.json({ message : 'sdk error' });
});
});
app.use('/api', router);
// get the app environment from Cloud Foundry
var appEnv = cfenv.getAppEnv();
// start server on the specified port and binding host
app.listen(appEnv.port, '0.0.0.0', function() {
// print a message when the server starts listening
console.log("server starting on " + appEnv.url);
});
启动日志
Starting app instance (index 0) with guid 8a0df22f-7c18-476f-8dc0-91c3db946ac6
Updated app with guid 8a0df22f-7c18-476f-8dc0-91c3db946ac6 ({"state"=>"STARTED"})
Detected 1024 MB available memory, 512 MB limit per process (WEB_MEMORY)
Recommending WEB_CONCURRENCY=2
Activating app management utilities: devconsole, shell, inspector
2015/10/27 10:46:52 authenticator url is detected as https://api.ng.bluemix.net/v2/apps/8a0df22f-7c18-476f-8dc0-91c3db946ac6/env
2015/10/27 10:46:52 The application base path is detected as /home/vcap
2015/10/27 10:46:52 Starting the proxy agent on port 61392
2015/10/27 10:46:52 Begin to start the runtime...
Starting utility: devconsole...
Adding proxy entry with: {"type": "http-forward", "backend": "127.0.0.1:8788", "host": "*", "uri_prefix": "bluemix-debug/manage"}
2015/10/27 10:46:52 Catch event "/home/vcap/app/.app-management/bin/proxy.config": WRITE. Reload the registry.
Starting utility: shell...
Adding proxy entry with: {"type": "http-forward", "backend": "127.0.0.1:8789", "host": "*", "uri_prefix": "bluemix-debug/shell"}
2015/10/27 10:46:52 Catch event "/home/vcap/app/.app-management/bin/proxy.config": WRITE. Reload the registry.
Starting utility: inspector...
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 1132 828 ? S<s 10:46 0:00 wshd: 192t1kppgo2
vcap 29 0.0 0.0 270040 5408 ? S<sl 10:46 0:00 .app-management/bin/proxyAgent
vcap 35 0.0 0.0 19592 3452 ? S< 10:46 0:00 bash /home/vcap/app/.app-management/handlers/start-inspector/run
vcap 45 0.0 0.0 19596 3408 ? S< 10:46 0:00 bash /home/vcap/app/.app-management/scripts/start 61393
vcap 72 0.0 0.0 677992 25228 ? R<l 10:46 0:00 /home/vcap/app/.app-management/node/bin/node bin/dev.js bluemix-debug/manage 8788
vcap 88 0.0 0.0 677992 23480 ? R<l 10:46 0:00 npm
vcap 113 0.0 0.0 611432 20688 ? R<l 10:46 0:00 /home/vcap/app/.app-management/node/bin/node server.js bluemix-debug/shell 8789
vcap 145 0.0 0.0 19588 292 ? R< 10:46 0:00 bash /home/vcap/app/.app-management/handlers/start-inspector/run
vcap 146 0.0 0.0 17172 2472 ? R< 10:46 0:00 ps aux
Adding proxy entry with: {"type": "http-forward", "backend": "127.0.0.1:8790", "host": "*", "uri_prefix": "bluemix-debug/inspector"}
2015/10/27 10:46:52 Catch event "/home/vcap/app/.app-management/bin/proxy.config": WRITE. Reload the registry.
> NodejsStarterApp@0.0.1 start /home/vcap/app
> node app.js
node-inspector is active. Visit the web page to start debugging.
module.js:338
throw err;
^
Error: Cannot find module 'ibmbluemix'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/home/vcap/app/app.js:11:18)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
npm ERR! Linux 3.19.0-25-generic
npm ERR! argv "/home/vcap/app/vendor/node/bin/node" "/home/vcap/app/vendor/node/bin/npm" "start"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! code ELIFECYCLE
npm ERR! NodejsStarterApp@0.0.1 start: `node app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the NodejsStarterApp@0.0.1 start script 'node app.js'.
npm ERR! This is most likely a problem with the NodejsStarterApp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node app.js
npm ERR! You can get their info via:
npm ERR! npm owner ls NodejsStarterApp
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/vcap/app/npm-debug.log
2015/10/27 10:46:53 Fail to start the application runtime: The runtime cannot be started. Error: Runtime start script returns error 'exit status 1'. Please check the application logs for more details.
Restarting the runtime in debug mode...
scripts/stop: line 27: kill: (88) - No such process
kill -9 88
scripts/stop: line 32: kill: (88) - No such process
Starting app with 'node --debug=5858 app.js '
Debugger listening on port 5858
module.js:338
throw err;
^
Error: Cannot find module 'ibmbluemix'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/home/vcap/app/app.js:11:18)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
firstappli.mybluemix.net - [27/10/2015:11:01:33 +0000] "GET /bluemix-debug/manage/tools/runtime HTTP/1.1" 200 0 69 "-" "Jakarta Commons-HttpClient/3.1" 108.168.250.153:11163 x_forwarded_for:"198.11.229.213" vcap_request_id:2ce77b66-4cc0-403d-6558-a020a23e4b93 response_time:0.259158396 app_id:8a0df22f-7c18-476f-8dc0-91c3db946ac6
我不明白,我没有尝试在本地测试代码,但令我惊讶的是互联网上没有人遇到与我相同的错误。也许我忘记了一些明显的事情......感谢您的帮助!
PS:我没有使用创建的默认空间,但我创建了一个新空间(否则我无法创建 Node 应用程序),也许会有一些影响...
最佳答案
您需要将 ibmbluemix
添加为 package.json
文件中的依赖项:
{
"name": "NodejsStarterApp",
"version": "0.0.1",
"description": "A sample nodejs app for Bluemix",
"scripts": {
"start": "node app.js"
},
"dependencies": {
"express": "4.12.x",
"cfenv": "1.0.x",
"ibmbluemix": "1.0.0"
},
"repository": {},
"engines": {
"node": "0.12.x"
}
}
如果您想在本地尝试应用程序,请在更改 package.json
文件后运行以下命令:
# npm install
# node app.js
关于node.js - 在 ibm cloud 上启动应用程序时找不到模块 'ibmbluemix',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33366591/
IBM Watson 和 IBM Inforsphere BigInsights (IBM Hadoop)/Streams 之间有什么区别? Watson 带来了 BigInsights 无法提供的哪
据我所知,Rational 是一种测试工具,而 Rational Rose 是一种建模工具。 最佳答案 Rational 是一家为软件开发生命周期制作工具的公司。 Rational Rose 就是这样
我尝试将 ibm-eventstreams-dev v 0.1.1 安装到 IBM Cloud Private 中,但收到一条错误消息: 内部服务错误:图表与 Tiller v2.6.0 不兼容 最佳
我正在尝试配置连接到集群MQ的集群Websphere应用程序服务器。 但是,我所掌握的信息是两个具有不同主机名,服务器通道和队列管理器的MQ实例的详细信息,这些主机名属于同一MQ集群名称。 在Webs
我想问问你们中的一些聪明人 :) 是否可以在 IBM Connections 文件中使用目录结构。还有图书馆,但我无法通过 webdav/smdb 映射它,也许这是关于我的信息差距,但我可以安装桌面插
我一次又一次地读到 IBM i 是一个支持多种编程语言的现代系统。除了 COBOL 和 RPG 之外,我如何确定哪些可供我使用? 维基百科上提供了一份 list ,我对 C、C++、BASIC、Sma
是否可以将 IBM HTTP 服务器设置为非 IBM Websphere 应用程序服务器(Glassfish、Apache Tomcat 或其他 Java 应用程序服务器)的前端?IBM 支持吗?我试
我有一个在 IBM Bluemix 上运行的简单 JSF 应用程序,与以下 J2EE 依赖项配合良好。 javax javaee-web-api 6.
我正在查看一个 RPG 程序。有一些这样的子程序:有没有工具哪个会将其创建为一个过程,可以在单独的过程中使用? C Eval FinQty# = 0
我正在设计一个新的体系结构大数据,我的客户将其作为IBM MQ代理使用。我们曾经在大数据架构中与Kafka一起工作,因为我想它比其他选择更快,更可靠,更强大,并且因为风暴和火花流在Kafka中更容易工
我偶然发现了一些 FMTDTA,它似乎是一种查询/排序语言,早于旧 RPG 系统中的 SQL。我试图解开它的用法。 例子: 物理文件布局: ORNO S 9 0 1
除了许可之外,IBM Worklight 的企业版和消费者版之间在功能方面是否存在任何差异? 最佳答案 企业版的销售目的是在组织内使用 (B2E)。许可证是“每台设备”。消费者版旨在以 B2C 的形式
我希望使用 IBM Worklight v5.0.5 Fix pack 1 设置 Eclipse 开发环境。 我可以获得有关旧版本 Worklight 的安装链接的一些指示吗? 最佳答案 查看下面的可
是否可以保留已检索且不再位于队列中的消息历史记录(包含消息内容将是完美的)? 在应用程序中,我可以看到发送者何时尝试将消息放入队列以及接收者何时尝试拾取消息,但我想查看消息何时真正到达队列以及消息何时
我正在向远程队列发送消息,但我无法控制该队列。 我发送一个 xml 文件作为消息,但是当应用程序读取消息时,它会得到一个消息头,例如 jms_text \0\0\0lqueue:///TEST128
在什么情况下队列管理器可能会失去与集群环境中存储库的连接?我的环境中队列管理器经常失去与存储库的连接,我需要刷新集群来修复此问题并重新建立与集群中其他队列管理器的通信。 我们的集群有 100 个队列管
我们正在为助手实现 Watson 技术,以帮助某些用户。 对话有些复杂,有时需要针对某些问题做跳答,这样做的坏处是用户可以再问一遍问题,以防不明白这就是问题所在。 当想进入后续进入的节点时,该节点进行
我们有一个启用了 DevOps 交付管道的 NodeJS Cloud Foundry 应用程序。 最初,我们将管道设置为使用 Bluemix 中交付管道的 Active Deploy 扩展来部署应用程
请注意,此问题特定于“IBM DB2 for i”,即 IBM i 操作系统的 version of DB2 . 下面的屏幕截图显示了一个故意错误的 INSERT 语句,它产生了 SQL0407 的
我想使用 IBM Websphere MQ 客户端 v7.5。我正在编写独立的 JMS 客户端应用程序来发送和使用来自 IBM WebsphereMQ 服务器的消息(它在其他地方运行,但我有权发送/接
我是一名优秀的程序员,十分优秀!