简体   繁体   English

TypeError [ERR_INVALID_CALLBACK]:回调必须是Express JS函数

[英]TypeError [ERR_INVALID_CALLBACK]: Callback must be a function Express JS

I have installed an older version of ExpressJS ( npm i express@3 -g ) and had problems with express generator. 我已经安装了较旧版本的ExpressJS( npm i express@3 -g ),并且Express Generator出现问题。 After i typed express -s -e in shell i got: 在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

My system is Windows 7. 我的系统是Windows 7。

I met this,my node version was 10.0.0,and I changed its version to 9.11.2 . 我遇到了这个问题,我的节点版本是10.0.0,然后将其版本更改为9.11.2 This worked for me. 这对我有用。 You could change node to old version. 您可以将节点更改为旧版本。 hope it helpful. 希望对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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