《node.js 开发指南》bash: express: command not found
2018-01-31 17:04
597 查看
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());
});
$ 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());
});
相关文章推荐
- NodeJS express command not found
- node.js开发错误——Error: Connection strategy not found
- Nodejs 开发指南 Nodejs+Express+ejs 开发microblog开发心得
- Centos7.4最小安装使用wget下载报:-bash wget command not found
- -bash:ntp:command not found
- 解决bash: ifconfig: command not found
- 如何在Mac中使用Android SDK,使用adb工具避免出现-bash: adb: command not found
- android studio mac :-bash: gradlew: command not found
- -bash: mysql: command not found
- Node.js开发指南中的例子(mysql版)
- Linux执行命令提示:bash:command not found
- Linux:-bash: ***: command not found
- 解决mac安装homebrew后报错-bash: brew: command not found
- -bash: git: command not found
- express: command not found.
- bash: useradd: command not found
- automation - Jenkins pipline 执行 nodejs 命令时,提示 node: command not found
- telnet不能用!!!提示:-bash: telnet: command not found
- mac 下的 bash gradle command not found
- LINUX -bash java command not found