小编Jac*_*ack的帖子

无法在Google App引擎上部署我的reactjs webpack应用程序

我正在尝试部署我的反应应用程序,它是100%前端但在webpack服务器上运行.我需要将其部署到Google应用引擎作为一个灵活的环境,但我做了这个后得到了这个错误gcloud app deploy

sh: 1: webpack: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! react-hot-boilerplate@1.0.0 bundle: `webpack --config webpack.config.js`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the react-hot-boilerplate@1.0.0 bundle script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2017-05-27T15_14_54_097Z-debug.log

npm ERR! …
Run Code Online (Sandbox Code Playgroud)

google-app-engine node.js reactjs gcloud webpack

5
推荐指数
1
解决办法
1592
查看次数

如何使用next.js中的getInitialProps方法获取Cookie?

我面临next.js的问题

当我向提出要求时,我无法获得Cookie async static getInitialProps。我得到undefined

但是,当我将其放入componentWillMount时没有问题。不幸的是,为时已晚,因为我需要在调用组件之前获取cookie信息。所以我需要把它拿进去getInitialProps

在这里,我已经尝试过但没有成功的事情:

static async getInitialProps () {
      const res = await axios.get('http://mybackend/getCookie');
      return {data : res.data}
    }
    
    //res.data = undefined
Run Code Online (Sandbox Code Playgroud)

有什么建议吗?

cookies node.js next.js

4
推荐指数
1
解决办法
5403
查看次数