Open shenchunyu opened 6 years ago
在 ./node_modules/react-qiniu/index.js 第33行,增加一行如下代码
if (typeof window == 'undefined' || typeof document == 'undefined') { return {} }
Error: Failed to lookup view "../dist/index.ejs" in views directory "/root/ziiyan/views"
at Function.render (/root/ziiyan/node_modules/express/lib/application.js:580:17)
at ServerResponse.render (/root/ziiyan/node_modules/express/lib/response.js:1008:7)
at /root/ziiyan/server/routes/serverRender.js:117:15
at /root/ziiyan/server/routes/serverRender.js:45:5
at callback (/root/ziiyan/src/containers/home/index.js:57:9)
at callback (/root/ziiyan/src/actions/posts.js:132:9)
at /root/ziiyan/src/common/ajax.js:77:7
at process._tickCallback (internal/process/next_tick.js:178:7)
Error: Failed to lookup view "../dist/index.ejs" in views directory "/root/ziiyan/views"
at Function.render (/root/ziiyan/node_modules/express/lib/application.js:580:17)
at ServerResponse.render (/root/ziiyan/node_modules/express/lib/response.js:1008:7)
at /root/ziiyan/server/routes/serverRender.js:117:15
at loadData (/root/ziiyan/server/routes/serverRender.js:31:5)
at /root/ziiyan/server/routes/serverRender.js:98:9
at /root/ziiyan/node_modules/react-router/lib/match.js:65:5
at /root/ziiyan/node_modules/react-router/lib/createTransitionManager.js:118:11
at done (/root/ziiyan/node_modules/react-router/lib/AsyncUtils.js:79:19)
at /root/ziiyan/node_modules/react-router/lib/AsyncUtils.js:85:7
at getComponentsForRoute (/root/ziiyan/node_modules/react-router/lib/getComponents.js:15:5)
at /root/ziiyan/node_modules/react-router/lib/getComponents.js:41:5
at /root/ziiyan/node_modules/react-router/lib/AsyncUtils.js:84:5
at Array.forEach (
还是跑不起来 端口改成80 地址改成域名
错误上看,是没有 ../dist/index.ejs 文件。 views 这个是什么,好像我的项目没有 views 这个文件夹。
/node_modules/react-qiniu/index.js:33 if (window.location.protocol === 'https:') { ^
ReferenceError: window is not defined at Function.getDefaultProps (/root/ziiyan/node_modules/react-qiniu/index.js:33:9) at Object.createClass (/root/ziiyan/node_modules/react/lib/ReactClass.js:681:46) at Object. (/root/ziiyan/node_modules/react-qiniu/index.js:13:24)
at Module._compile (internal/modules/cjs/loader.js:678:30)
at Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Object.require.extensions.(anonymous function) [as .js] (/root/ziiyan/node_modules/babel-register/lib/node.js:152:7)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3)
at Module.require (internal/modules/cjs/loader.js:626:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object. (/root/ziiyan/src/components/qiniu-upload-image/index.js:3:1)
at Module._compile (internal/modules/cjs/loader.js:678:30)
at loader (/root/ziiyan/node_modules/babel-register/lib/node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (/root/ziiyan/node_modules/babel-register/lib/node.js:154:7)
at Module.load (internal/modules/cjs/loader.js:589:32)