小编tar*_*ill的帖子

node.js找不到模块xml2js

我在我的机器上做了一个应用程序,它运行良好.我将它上传到服务器,它崩溃了以下错误:

node.js:116
        throw e; // process.nextTick error, or 'error' event on first tick
        ^
Error: Cannot find module 'xml2js'
    at Function._resolveFilename (module.js:289:11)
    at Function._load (module.js:241:25)
    at require (module.js:317:19)
    at Object.<anonymous> (/var/www/node/price/index.js:3:14)
    at Module._compile (module.js:373:26)
    at Object..js (module.js:379:10)
    at Module.load (module.js:305:31)
    at Function._load (module.js:271:10)
    at Array.<anonymous> (module.js:392:10)
    at EventEmitter._tickCallback (node.js:108:26)
Run Code Online (Sandbox Code Playgroud)

这是我的应用程序开始的方式:

var express=require('express');
var http=require('http');
var xml2js = require('xml2js');
var sys = require('sys');
var util = require('util');
Run Code Online (Sandbox Code Playgroud)

我使用npm安装了express和xml2js.我的机器和服务器上的节点具有完全相同的版本(v0.4.0).

我确保xml2js和express驻留路径(/ usr/local/lib/node /)包含在节点查找模块的路径中.(我编辑了'module.js'文件来打印它寻找模块的路径.)

node.js:116
        throw e; // process.nextTick error, or 'error' event on …
Run Code Online (Sandbox Code Playgroud)

linux include node.js

19
推荐指数
4
解决办法
3万
查看次数

标签 统计

include ×1

linux ×1

node.js ×1