Node.js中文网下载地址
node
npm install express -g # -g 全局安装
若是沒有-g的话会安装到当前node_modules目录下(如无则新建node_modules文件夹)。web
This problems seems to be quite popular among Windows users. It seems to occur after node has been reinstalled or updated or when hidden attribute has been removed from C:\Users\IMaster\AppData folder. It might be one of those things that can make you feel bad especially if you don’t wont to apply some quick hacks like: npm link expressexpress
Node returns error because is not able to find required module and that is why problem in most cases is actually easy to fix. First place to check would be require.paths. After typing it in node console I received:
Error: require.paths is removed. Use node_modules folders, or the NODE_PATH environment variable instead.npm
At the time of writing I am using v0.6.19 but you might see this or similar warning if you using newer version.api
As stated you have 2 choices. You can install express (or another module) to local node_modules directory using npm install express or after installing module globallyapp
npm install express -gsvg
you can link it with your current project usingui
npm link expressthis
Second and last option is to create or update NODE_PATH system variable pointing your node to the right place in the system. If you are Windows user use export command as shown below:3d
export NODE_PATH=“C:\Users\IMarek\AppData\Roaming\npm\node_modules”
Now you should update PATH variable as well
set PATH=%PATH%;%NODE_PATH%
Try to run your module now.
You should be fine.