Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 如何跟踪导致require.paths错误的模块?_Node.js_Coffeescript - Fatal编程技术网

Node.js 如何跟踪导致require.paths错误的模块?

Node.js 如何跟踪导致require.paths错误的模块?,node.js,coffeescript,Node.js,Coffeescript,我已经设置了一个简单的咖啡脚本web服务器: http = require 'http' express = require 'express' http.createServer (req, res) -> res.writeHead 200 res.end 'Hello, World!' .listen 8888 console.log 'Server running at http://127.0.0.1:8888/' 当我运行此功能时,它很好,

我已经设置了一个简单的咖啡脚本web服务器:

http = require 'http'
express = require 'express'

http.createServer (req, res) ->
        res.writeHead 200
        res.end 'Hello, World!'
.listen 8888

console.log 'Server running at http://127.0.0.1:8888/'
当我运行此功能时,它很好,可以提供页面:

~/jsfinder> coffee app.coffee
Server running at http://127.0.0.1:8888/
好的,没问题。但当我尝试与nodemon相同时,我得到:

~/jsfinder> nodemon app.coffee

Error: require.paths is removed. Use node_modules folders, or the NODE_PATH environment variable instead.
    at Function.Module._compile.Object.defineProperty.get (module.js:386:11)
    at Object.<anonymous> (/home/user/bin/nodemon@0.6.12:4:21)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:492:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)
以及:


这说明全局或局部中没有模块使用require.path混乱

我同意前者,并愿意打赌错误在
nodemon@0.6.12:4:21
:)


我认为你的更新命令不起作用,因为
nodemon
应该是
@0.6.23

如果你用纯Node.js(不含CoffeeScript)做同样的示例,它能起作用吗?@HectorCorrea不,我尝试了hello world的节点版本,得到了同样的结果。对不起,我的错,那篇文本已经过时了。复制后,我做了一个全局更新,然后重新运行应用程序,得到了相同的结果。我会的,但我99%确定堆栈跟踪是相同的,除了版本号。多么奇怪,堆栈跟踪仍然显示为0.6.12,尽管npm说nodemon为0.6.23;当我试图追踪这一点时,我完全卸载了我的所有模块。似乎有点不对劲。堆栈跟踪线:'位于对象。(/home/user/bin)/nodemon@0.6.12:4:21)“这个答案让我走上了正确的轨道:不知何故,我的/home/user/bin中有一个旧版本的nodemon,而我的nodemon命令却指向了它。不知道它是怎么出现的,也许是一个奇怪的nodemon安装?不管怎样,删除它并将其指向正确的位置就解决了问题。很高兴你找到了流氓nodemon!
/usr/lib/nodejs/npm/node_modules> find . -type f -print0 | xargs -0 grep require.paths
/usr/lib/nodejs/npm/node_modules> cd ..
/usr/lib/nodejs/npm> find . -type f -print0 | xargs -0 grep require.paths
/usr/lib/nodejs/npm> cd ..
/usr/lib/nodejs> find . -type f -print0 | xargs -0 grep require.paths
./module.js:    throw new Error('require.paths is removed. Use ' +
~/jsfinder> find . -type f -print0 | xargs -0 grep require.paths
~/jsfinder>