Tag Archives: Nodejs Error

[Solved] Nodejs Error: Cannot find module ‘express’

What are the eight life cycle hook functions of Vue>>>

C:\Users\0>node E:\Project\2018\Dec\nodejs\express_demo.js
module.js:471
    throw err;
    ^

Error: Cannot find module 'express'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (E:\Project\2018\Dec\nodejs\express_demo.js:1:77)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

C:\Users\0>express --version
4.16.0

Actually, I have the express module installed

It’s strange

Then try one method is to enter the project directory and then install the express module, which is invalid

Finally, it turned out to be node_ Modules does not have an environment variable configured

Configuration:

1. Control panel all control panel items system advanced system settings environment variables

New construction of “node”_ PATH’:C:\Users\0\AppData\Roaming\npm\node_ modules

Edit add environment variable ‘path’

Perfect~~