简体   繁体   中英

openshift - nodejs module cannot find module “mosca”,

We are getting the following error while adding mosca = require("mosca") to my server.js script., any pointers here will be helpful. ^

Error: Cannot find module 'mosca/index.js'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/var/lib/openshift/537dd88d5973ca6907000057/app-root/runtime/repo/server.js:8:15)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
DEBUG: Program node server.js exited with code 8
DEBUG: Starting child process with 'node server.js'

You need to install the package first:

npm install mosca

Better yet, install it and add it to your package.json :

npm install --save mosca

现在已解决此问题,有些mosca模块未安装,因此我已在本地安装并将内容复制到node_modules

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM