【问题标题】:TypeError [ERR_INVALID_CALLBACK]: Callback must be a function Express JSTypeError [ERR_INVALID_CALLBACK]: Callback must be a function Express JS
【发布时间】:2019-05-20 22:37:19
【问题描述】:

我安装了旧版本的 ExpressJS (npm i express@3 -g),但遇到了 express 生成器的问题。在我在 shell 中输入 express -s -e 后,我得到了:

    $ express -s -e

   create : .

   install dependencies:
     $ cd . && npm install

   run the app:
     $ node app

fs.js:157
  throw new ERR_INVALID_CALLBACK();
  ^

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
    at maybeCallback (fs.js:157:9)
    at Object.fs.writeFile (fs.js:1276:14)
    at write (C:\Users\Влад\AppData\Roaming\npm\node_modules\express\bin\express:41
2:6)
    at C:\Users\Влад\AppData\Roaming\npm\node_modules\express\bin\express:385:5
    at C:\Users\Влад\AppData\Roaming\npm\node_modules\express\bin\express:427:11
    at C:\Users\Влад\AppData\Roaming\npm\node_modules\express\node_modules\mkdirp\i
ndex.js:48:26

我的系统是 Windows 7。

【问题讨论】:

    标签: javascript node.js express


    【解决方案1】:

    我遇到了这个,我的节点版本是 10.0.0,我将其版本更改为 9.11.2。这对我有用。您可以将节点更改为旧版本。希望对您有所帮助。

    【讨论】:

      猜你喜欢
      • 2021-04-29
      • 2021-05-13
      • 1970-01-01
      • 1970-01-01
      • 2017-04-08
      • 2014-07-26
      • 1970-01-01
      • 2019-06-18
      • 2018-01-18
      相关资源
      最近更新 更多