《node.js 开发指南》bash: express: command not found

1)bash: express: command not found
$ npm install -g express 安装成功后,运行express –help 报bash: express: command not found
解决方法:npm install -g express-generator
2) express -t ejs microblog
express -t ejs microblog 安装后查看package.json,装的是jade,而不是esj。
解决方法:express -e microblog
3)app.js 没法启动
解决方法:npm start
4)创建/hello 页面
按照书本在app.js 后添加app.get(‘/hello’, routes.hello); 是没法实现的,然后index.js 后添加hello 函数
解决方案:app.use(‘/hello’, index);
router.get(‘/hello’, function(req, res, next) {
res.send(‘The time is ’ + new Date().toString());
});

猜你喜欢

转载自blog.csdn.net/yana_loo/article/details/79219615