Quantcast
Channel: CNode:Node.js专业中文社区
Viewing all articles
Browse latest Browse all 14821

这几天配的项目 全部静态资源都加载不了,求帮助,急!!!

$
0
0

屏幕快照 2016-08-26 下午5.42.30.png

全部放在 public 文件下的 都返回这个json

{"_readableState":{"objectMode":false,"highWaterMark":65536,"buffer":[],"length":0,"pipes":null,"pipesCount"
:0,"flowing":null,"ended":false,"endEmitted":false,"reading":false,"sync":true,"needReadable":false,"emittedReadable"
:false,"readableListening":false,"resumeScheduled":false,"defaultEncoding":"utf8","ranOut":false,"awaitDrain"
:0,"readingMore":false,"decoder":null,"encoding":null},"readable":true,"domain":null,"_events":{},"_eventsCount"
:1,"path":"/home/test/hired_apply_wechat/public/css/style.css","fd":null,"flags":"r","mode":438,"autoClose"
:true}

app.js 是这样的

'use strict'

require('./init')
require('./config/global')

const path = require('path')
const Koa = require('koa')
const convert = require('koa-convert')
const mountRoutes = require('./app/common/mount-koa-routes')
const $middlewares = require('./app/common/mount-middlewares')(__dirname)

const app = new Koa()

app.keys = [Config.session_secret]

// middlewares
app.use(convert($middlewares.compress))
app.use(convert($middlewares.bodyparser))
app.use(convert($middlewares.session))
app.use(convert($middlewares.helmet))
app.use(convert($middlewares.wechat_session))
app.use(convert($middlewares.json))
app.use(convert($middlewares.serve))
app.use(convert($middlewares.views))
app.use(convert($middlewares.favicon))
app.use(convert($middlewares.cors))
app.use(convert($middlewares.less))

// for production
if (process.env.NODE_ENV === 'production') {
    app.use(convert($middlewares.log4js()))
    app.use(convert($middlewares.static_cache))

    // mount routes from app/routes folder
    mountRoutes(app, path.join(__dirname, 'app/routes'), false)
} else if (process.env.NODE_ENV === 'test') {
    // for test
    console.log('test')

    // mount routes from app/routes folder
    mountRoutes(app, path.join(__dirname, 'app/routes'), true)
} else {
    // default for development
    app.use(convert($middlewares.logger))

    // request logger
    app.use(convert($middlewares.request_logger))

    // mount routes from app/routes folder
    mountRoutes(app, path.join(__dirname, 'app/routes'), true)
}

// response
app.on('error', function (err, ctx) {
    console.log(err)
})

module.exports = app

serve.js

const path = require('path')
const serve = require('koa-static')

// 检查用户会话
module.exports = serve(path.join(__dirname, '../../public'))

之前的项目 都正常,就是这两天新配的项目 npm install 之后 就会出现这个,把本地的旧项目copy 出来,把依赖删除了 npm install 之后也会这样……请问怎么解决

百度过 _readableState 好似是 io 文件处理的东西…… 不清楚问题出现在哪里 查回 koa-send ,koa-stati 这两个项目这段时间也好似没有更新,求大神帮助 , 急!!!!!!


Viewing all articles
Browse latest Browse all 14821

Trending Articles