Issue 1:
I've created the _app.js file exactly as the example in the documentation, and tried to build it, but i got a big error.

This is my _app.js

import App, { Container } from "next/app";
import React from "react";
import { CSSTransition, TransitionGroup } from "react-transition-group";
import Layout from "../components/App";

export default class MyApp extends App {
static async getInitialProps({ Component, router, ctx }) {
let pageProps = {};

if (Component.getInitialProps) {
pageProps = await Component.getInitialProps(ctx);
}
console.log(ctx, "rendering!");

return { pageProps };
}

render() {
const { Component, pageProps } = this.props;
return (
<Container>
<Layout>
<TransitionGroup>
<CSSTransition
key={this.props.router.route}
classNames="fade"
timeout={2000}>
<Component {...pageProps} />
</CSSTransition>
</TransitionGroup>
</Layout>
<style jsx global>{`...`}</style>
</Container>
);
}
}

I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

Project built up to run yarn start

Current Behavior

yarn run v1.5.1
$ next build
> Using external babel configuration
> Location: "/Users/facundogordillo/OneDrive/clinical-web-next/.babelrc"
> Failed to build
{ Error: (client) ./pages/_app.js
Module not found: Error: Can't resolve 'next/app' in '/Users/facundogordillo/OneDrive/clinical-web-next/pages'
resolve 'next/app' in '/Users/facundogordillo/OneDrive/clinical-web-next/pages'
Parsed request is a module
using description file: /Users/facundogordillo/OneDrive/clinical-web-next/package.json (relative path: ./pages)
aliased with mapping 'next': '/Users/facundogordillo/OneDrive/clinical-web-next/node_modules/next' to '/Users/facundogordillo/OneDrive/clinical-web-next/node_modules/next/app'
using description file: /Users/facundogordillo/OneDrive/clinical-web-next/package.json (relative path: ./pages)
Field 'browser' doesn't contain a valid alias configuration
after using description file: /Users/facundogordillo/OneDrive/clinical-web-next/package.json (relative path: ./pages)
using description file: /Users/facundogordillo/OneDrive/clinical-web-next/node_modules/next/package.json (relative path: ./app)
no extension
Field 'browser' doesn't contain a valid alias configuration
/Users/facundogordillo/OneDrive/clinical-web-next/node_modules/next/app doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/Users/facundogordillo/OneDrive/clinical-web-next/node_modules/next/app.js doesn't exist
.jsx
Field 'browser' doesn't contain a valid alias configuration
/Users/facundogordillo/OneDrive/clinical-web-next/node_modules/next/app.jsx doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
/Users/facundogordillo/OneDrive/clinical-web-next/node_modules/next/app.json doesn't exist
as directory
/Users/facundogordillo/OneDrive/clinical-web-next/node_modules/next/app doesn't exist
[/Users/facundogordillo/OneDrive/clinical-web-next/node_modules/next/app]
[/Users/facundogordillo/OneDrive/clinical-web-next/node_modules/next/app.js]
[/Users/facundogordillo/OneDrive/clinical-web-next/node_modules/next/app.jsx]
[/Users/facundogordillo/OneDrive/clinical-web-next/node_modules/next/app.json]
[/Users/facundogordillo/OneDrive/clinical-web-next/node_modules/next/app]

Context

.babelrc

{
"presets": ["next/babel"],
"plugins": ["import-static-files"]
}

I don't have a next.config.js file.

Your Environment

Tech
Version

next
5.1.0

node
9.11.1

OS
MacOS High Sierra

browser
Firefox Developer Edition

Issue 2:
I'm trying to integrate Flow with my current next project I notice there is a issue with

getInitialProps method. Flow complains:

I'm a little bit confused do I have to specify

static getInitialProps: (ctx: {pathname: string, query: any, req?: any, res?: any, jsonPageRes?: any, err?: any}) => Promise<any>;

for every page or it could be done with next.js.flow file?

I see there is definition within the file

declare module "next/document" {
declare export var Head: Class<React$Component<any, any>>;
declare export var Main: Class<React$Component<any, any>>;
declare export var NextScript: Class<React$Component<any, any>>;
declare export default Class<React$Component<any, any>> & {
getInitialProps: (ctx: {pathname: string, query: any, req?: any, res?: any, jsonPageRes?: any, err?: any}) => Promise<any>;
renderPage(cb: Function): void;
};
}

But it seems this definition already have some problems. Please note I tried with flow-bin version specified in the example, but I also tried with newest flow-bin and it seems the same.

I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

I think this has to work automatically if it's well defined within the next.js.flow file

Steps to Reproduce (for bugs)

Take with-flow example

Change index.js page to be statefull component and add getInitialProps to it

run yarn flow

Your Environment

Tech
Version

next
latest

node
8.7.0

OS
OSX