I just started node.js these days. I ran the simplest case in the C disk before. Later, I modified F disk F:\nodejs and added global and cache files according to the tutorial. However, the version number of inside I Query express was reported wrong on the command line, and the result of require(“express “) in node mode is normal. . . I am. . .
, and then build a Web service, to a hello world, the result is reported as follows
`Please enter a code
Error: Cannot find module ‘C:\Windows\System32\service.js’
at Function.Module._resolveFilename (module.js:339:15) at Function.Module._load (module.js:290:25) at Function.Module.runMain (module.js:447:10) at startup (node.js:141:18) at node.js:933:3
`throw the service.js file into the wrong directory to run normally, but there are many files = =
Can you tell me how
1. Drop it into the root directory of nodejs file on F disk to run.
2. Xiao Bai is not very clear about how to deploy the project documents. he lost the c disk and ran under the directory before. it is not convenient to manage it later, is it
For documents written by oneself, the relative path should be used when requesting, preceded by. or ..
For example, if you put server.js in F:\nodejs, the main file inside should write when running node in the directory inside
To use express on the command line, you should
npm install -g express-generator