Error: Cannot find module 'express'

来源:互联网 发布:软件测试平均工资 编辑:程序博客网 时间:2024/05/20 06:41
使用npm install express --save 安装express后,
在js中定义var express = require('express');
运行该js时,报错:Error: Cannot find module 'express'
在stackoverflow找到:
Check if you are not install express module, use this command:


 npm install express
and if your node_modules directory is in another place, set NODE_PATH envirnment variable:


 set NODE_PATH=your\directory\to\node_modules;%NODE_PATH%
按照这方法,设置我的环境变量。
再次运行js即可 
0 0
原创粉丝点击