Nodejs Cannot find module

前端 未结 5 438
南旧
南旧 2020-12-30 00:40

I\'m getting an error when trying to use any global module, exemple:

Error: Cannot find module \'express\'
    at Function.Module._resolveFilename (module.js:         


        
5条回答
  •  别那么骄傲
    2020-12-30 01:05

    You should install Express locally:

    npm install express
    

    Then require it as you did:

    var express = require('express')
    

提交回复
热议问题