easy-team / easywebpack-cli

A Powerful Cross-platform Webpack CLI Tool
https://easyjs.cn/easywebpack
MIT License
122 stars 28 forks source link

脚手架搭建的egg+多页面vue ssr,prod模式访问不了 #5

Closed kchjxxgh closed 6 years ago

kchjxxgh commented 6 years ago

NPM run dev,可以访问,但是npm run start,可以没有错误的启动,但是启动之后,页面没办法访问: 访问127.0.0.1:7001显示500错误 访问127.0.0.1:7001/client,在console打出以下错误: GET http://localhost:7001/public/js/vendor.js net::ERR_ABORTED 07:27:12.282 client:1 GET http://localhost:7001/public/js/index/index.js net::ERR_ABORTED 07:27:12.301 client:1 GET http://localhost:7001/public/js/vendor.js net::ERR_ABORTED 07:27:12.301 client:1 Refused to execute script from 'http://localhost:7001/public/js/vendor.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled. 07:27:12.305 client:1 GET http://localhost:7001/public/js/index/index.js net::ERR_ABORTED 07:27:12.305 client:1 Refused to execute script from 'http://localhost:7001/public/js/index/index.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

这里贴出npm log显示的我的环境: 2018-05-11 07:26:04,330 INFO 65204 [master] node version v8.11.1 2018-05-11 07:26:04,332 INFO 65204 [master] egg version 2.8.1 2018-05-11 07:26:04,333 INFO 65204 [master] start with options: { "framework": "P:\\workspace\\easywebpack\\btc\\node_modules\\egg", "baseDir": "P:\\workspace\\easywebpack\\btc", "workers": 8, "plugins": null, "https": false, "key": "", "cert": "", "typescript": false } 2018-05-11 07:26:04,338 INFO 65204 [master] start with env: isProduction: true, EGG_SERVER_ENV: prod, NODE_ENV: production

hubcarl commented 6 years ago

发布模式,访问之前需要先 npm run build 或者重新用最新的骨架试试