Closed ynchuan closed 4 years ago
差异并不大。启动失败请丢错误原因。不要自己改了启动方式后说启动失败
@ynchuan 给一下日志吧
@i5ting 使用tnpm i
安装后npm start
执行就会出问题,如果换成使用npm i
就正常了,应该是内部镜像有问题,方便的话看下
> ssr-with-ts@2.3.1 start /Users/xxx/workspace/fe/yk/ssrts
> concurrently "npm run ssr" "npm run csr"
[0]
[0] > ssr-with-ts@2.3.1 ssr /Users/xxx/workspace/fe/yk/ssrts
[0] > concurrently "cross-env NODE_ENV=development midway-bin dev --ts" "cross-env NODE_ENV=development webpack --watch --config ./build/webpack.config.server.js"
[0]
[1]
[1] > ssr-with-ts@2.3.1 csr /Users/xxx/workspace/fe/yk/ssrts
[1] > cross-env NODE_ENV=development ykcli dev
[1]
[0] [1]
[0] [1] webpack is watching the files...
[0] [1]
[0] [0]
[0] [0] /Users/xxx/workspace/fe/yk/ssrts/node_modules/_egg-bin@4.14.1@egg-bin/lib/start-cluster:8
[0] [0] require(options.framework).startCluster(options);
[0] [0] ^
[0] [0] TypeError: require(...).startCluster is not a function
[0] [0] at Object.<anonymous> (/Users/xxx/workspace/fe/yk/ssrts/node_modules/_egg-bin@4.14.1@egg-bin/lib/start-cluster:8:28)
[0] [0] at Module._compile (internal/modules/cjs/loader.js:945:30)
[0] [0] at Object.Module._extensions..js (internal/modules/cjs/loader.js:962:10)
[0] [0] at Module.load (internal/modules/cjs/loader.js:798:32)
[0] [0] at Function.Module._load (internal/modules/cjs/loader.js:711:12)
[0] [0] at Function.Module.runMain (internal/modules/cjs/loader.js:1014:10)
[0] [0] at internal/main/run_main_module.js:17:11
[0] [0] Error: /Users/xxx/workspace/fe/yk/ssrts/node_modules/_egg-bin@4.14.1@egg-bin/lib/start-cluster {"typescript":true,"workers":1,"framework":"/Users/xxx/workspace/fe/yk/ssrts/node_modules/midway","baseDir":"/Users/xxx/workspace/fe/yk/ssrts"} exit with code 1
[0] [0] at ChildProcess.<anonymous> (/Users/xxx/workspace/fe/yk/ssrts/node_modules/_common-bin@2.8.3@common-bin/lib/helper.js:56:21)
[0] [0] at Object.onceWrapper (events.js:300:26)
[0] [0] at ChildProcess.emit (events.js:210:5)
[0] [0] at ChildProcess.EventEmitter.emit (domain.js:476:20)
[0] [0] at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12) {
[0] [0] code: 1
[0] [0] }
[0] [0] cross-env NODE_ENV=development midway-bin dev --ts exited with code 1
[1] ℹ 「wds」: Project is running at http://0.0.0.0:8000/
[1] ℹ 「wds」: webpack output is served from /
[1] ℹ 「wds」: Content not from webpack is served from /Users/xxx/workspace/fe/yk/ssrts/dist
[1] Starting server on http://localhost:8000
[0] [1] Hash: 077fae00d747990b6c76
[0] [1] Version: webpack 4.19.1
[0] [1] Time: 1119ms
[0] [1] Built at: 2020/03/08 上午10:48:55
[0] [1] Asset Size Chunks Chunk Names
[0] [1] static/css/Layout.css 467 bytes Layout [emitted] Layout
[0] [1] Layout.server.js 19.2 KiB Layout [emitted] Layout
[0] [1] static/css/Page.css 967 bytes Page [emitted] Page
[0] [1] Page.server.js 61.5 KiB Page [emitted] Page
[0] [1] [./config/config.ssr.js] 1.09 KiB {Page} [built]
[0] [1] [./web/assets/common.less] 329 bytes {Page} {Layout} [built]
[0] [1] [./web/entry.tsx] 4.98 KiB {Page} [built]
[0] [1] [./web/layout/index.less] 329 bytes {Page} {Layout} [built]
[0] [1] [./web/layout/index.tsx] 3.65 KiB {Layout} {Page} [built]
[0] [1] [./web/page/index/index.less] 332 bytes {Page} [built]
[0] [1] [./web/page/index/index.tsx] 2.6 KiB {Page} [built]
[0] [1] [./web/page/news/index.tsx] 1.64 KiB {Page} [built]
[0] [1] [path] external "path" 42 bytes {Page} [built]
[0] [1] [react] external "react" 42 bytes {Page} {Layout} [built]
[0] [1] [react-dom] external "react-dom" 42 bytes {Page} [built]
[0] [1] [react-router-dom] external "react-router-dom" 42 bytes {Page} {Layout} [built]
[0] [1] [regenerator-runtime] external "regenerator-runtime" 42 bytes {Page} [built]
[0] [1] [serialize-javascript] external "serialize-javascript" 42 bytes {Page} {Layout} [built]
[0] [1] [ykfe-utils] external "ykfe-utils" 42 bytes {Page} [built]
[0] [1] + 7 hidden modules
不要用阿里的源来装midway,这个包有问题。
@zhangyuang OK
midway内外版本问题,close了
framework没有配置
另:ts项目模板和js模板差异好大