V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  chenqy930  ›  全部回复第 1 页 / 共 1 页
回复总数  9
2018-05-18 17:47:34 +08:00
回复了 chenqy930 创建的主题 Node.js 用 console.log()在控制台看不到输出
@YenvY 试过了 不行><
2018-05-18 17:47:07 +08:00
回复了 chenqy930 创建的主题 Node.js 用 console.log()在控制台看不到输出
@Yokira 怎么看 webpack 是编译前端还是后端呀.. 我就是用的 npm start...

另外好像找不到项目用来输出其他调试信息的代码,用到 winston 模块的只在这一段,
app.use((err, req, res, next) => {
logger.warn('%s', err.stack);
res.status(err.status || 500).json({
message: err.message,
error: config.env === 'development' ? err.stack : {}
});
});

输出的信息类似于:
2018-05-18T09:39:12.701Z [INFO] GET /view.html 304 0.330 ms - -
2018-05-18T09:39:12.709Z [INFO] GET /styles/view.bundle.css 304 0.638 ms - -
2018-05-18T09:39:12.709Z [INFO] GET /styles/layout.bundle.css 304 0.913 ms - -
2018-05-18T09:39:12.710Z [INFO] GET /scripts/view.bundle.js 304 1.225 ms - -
2018-05-18 10:55:20 +08:00
回复了 chenqy930 创建的主题 Node.js 用 console.log()在控制台看不到输出
@will0404
1、package.json 中没有看到 babel 模块,所以应该没有用到 babel。
2、运行前确实有个一分钟左右的编译过程,webpack 配置的话有一个文件是 webpack.common.js ,里面的模块有 entry、output、resolve、module、plugins 和 node,哪块会是跟 console 被去掉有关的呢?
2018-05-18 10:16:30 +08:00
回复了 chenqy930 创建的主题 Node.js 用 console.log()在控制台看不到输出
@dr490n
"scripts": {
"build:dev": "npm run clean && npm run preprocess && npm run webpack -- --watch",
"build": "npm run clean && npm run preprocess && npm run webpack",
"clean:dist": "npm run rimraf -- dist",
"clean": "npm cache clean && npm run clean:dist",
"lint": "eslint src/**/*.js",
"node": "node",
"preprocess": "node config/preprocess.js",
"rimraf": "rimraf",
"server": "node server/index.js",
"start": "npm run build && npm run server",
"test": "echo \"Error: no test specified\" && exit 1",
"webpack": "webpack --config webpack.config.js --progress --profile",
"yarn": "yarn --ignore-engines"
},


刚注意看了一下输出,
2018-05-18T00:47:17.942Z [INFO] config: {"env":"production","logLevel":"silly","serverPort":8080}
2018-05-18T00:47:17.950Z [INFO] Webportal server starts on port 8080
2018-05-18T00:47:42.867Z [WARN] Error: Page not found

确实是在 production, 然后我在配置文件中改成了 development, 还是没有输出><
2018-05-18T02:14:09.554Z [INFO] config: {"env":"development","logLevel":"silly","serverPort":8080}
2018-05-18 09:35:59 +08:00
回复了 chenqy930 创建的主题 Node.js 用 console.log()在控制台看不到输出
@wukaichao 应该不会
2018-05-18 09:35:44 +08:00
回复了 chenqy930 创建的主题 Node.js 用 console.log()在控制台看不到输出
@miketeam 想在后台看输出的,应该跟 html 没有关系吧?
2018-05-18 09:35:16 +08:00
回复了 chenqy930 创建的主题 Node.js 用 console.log()在控制台看不到输出
@noe132 噢还有这个可能,那这该怎么办呢?
2018-05-07 18:36:39 +08:00
回复了 chenqy930 创建的主题 NGINX ngnix 做代理的问题
有道理啊,可是 B 也不便修改呢- -
2018-05-07 10:36:02 +08:00
回复了 chenqy930 创建的主题 NGINX ngnix 做代理的问题
因为服务器 A 的代码不便修改,所以还是想尽量用代理实现,我去看看 lua,感谢~
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5463 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 15ms · UTC 08:52 · PVG 16:52 · LAX 01:52 · JFK 04:52
Developed with CodeLauncher
♥ Do have faith in what you're doing.