TypeError:require不是Object.module.exports.map中的函数 [英] TypeError: require is not a function at Object.module.exports.map

查看:91
本文介绍了TypeError:require不是Object.module.exports.map中的函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用gulp commm编译node js项目时发生以下错误.

while compiling node js project with gulp commmand below error occurs.

在public/js/app/app.node.js中:

In public/js/app/app.node.js:

var fs = require('fs');
             ^

TypeError:要求不是函数,位于Object.module.exports.map ../file

TypeError: require is not a function at Object.module.exports.map../file

我试图在当前项目中实现反应通量api调用.

I tried to implement react flux api calls with current project.

更新:

添加此错误已被删除

new dwebpack.DefinePlugin({ "global.GENTLY": false })

但当前发生以下错误.

return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                                                  ^

Error: ENOENT: no such file or directory, open '/types/mime.types'
    at Error (native)
    at Object.fs.openSync (fs.js:549:18)
    at Object.fs.readFileSync (fs.js:397:15)
    at Mime.load 

推荐答案

回答自己的问题不是正确的方法,但对其他人有帮助,而且人们在寻找已回答的问题时也这样做.

answering own question is not right way to do it but as it will be helpful for other and as people look for answered question also so doing this.

是我与节点版本有关的问题. 我使用的是最新的节点版本4.0.0,并且有问题.

as my issue with related to node version. i am on latest node version 4.0.0 and having issue with it.

因此安装了较低节点版本0.12.7(在模板代码的package.json中指定),并由npm install进行了重建,从而解决了该问题.

so installed lower node version 0.12.7(which was specified in package.json of template code) and rebuilt by npm install solved it.

我已将 https://www.npmjs.com/package/n 包用于安装多个节点版本并选择我要使用的版本.

i have used https://www.npmjs.com/package/n package to install multiple node version and selecting the one i wanted to use.

这篇关于TypeError:require不是Object.module.exports.map中的函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆