mars / heroku-nextjs

⏩ Deploy Next.js universal web apps to Heroku
https://nextjs.herokuapp.com
MIT License
371 stars 36 forks source link

Error building with absolute imports (babel-root-import) #8

Closed tgoldenberg closed 7 years ago

tgoldenberg commented 7 years ago

Here is my output, .babelrc, and next.config.js:

Counting objects: 130, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (127/127), done.
Writing objects: 100% (130/130), 53.45 KiB | 0 bytes/s, done.
Total 130 (delta 72), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        NPM_CONFIG_PRODUCTION=true
remote:        NODE_VERBOSE=false
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote:        engines.node (package.json):  6.9.x
remote:        engines.npm (package.json):   unspecified (use default)
remote:
remote:        Resolving node version 6.9.x via semver.io...
remote:        Downloading and installing node 6.9.5...
remote:        Using default npm version: 3.10.10
remote:        Resolving yarn version (latest) via semver.io...
remote:        Downloading and installing yarn (0.19.1)...
remote:        Installed yarn 0.19.1
remote:
remote: -----> Restoring cache
remote:        Loading 1 from cacheDirectories (package.json):
remote:        - nextjs/node_modules
remote:
remote: -----> Building dependencies
remote:        Installing node modules (yarn.lock)
remote:        yarn install v0.19.1
remote:        warning commandiv-next@1.0.0: No license field
remote:        [1/4] Resolving packages...
remote:        [2/4] Fetching packages...
remote:        warning fsevents@1.0.17: The platform "linux" is incompatible with this module.
remote:        info "fsevents@1.0.17" is an optional dependency and failed compatibility check. Excluding it from installation.
remote:        [3/4] Linking dependencies...
remote:        warning "material-ui@0.16.7" has unmet peer dependency "react@^15.0.0".
remote:        warning "material-ui@0.16.7" has unmet peer dependency "react-dom@^15.0.0".
remote:        warning "react-addons-css-transition-group@15.4.2" has unmet peer dependency "react@^15.4.2".
remote:        warning "react-addons-pure-render-mixin@15.4.2" has unmet peer dependency "react@^15.4.2".
remote:        warning "react-addons-transition-group@15.4.2" has unmet peer dependency "react@^15.4.2".
remote:        warning "react-ga@2.1.2" has unmet peer dependency "react@>= 0.14.0".
remote:        warning "react-redux@5.0.2" has unmet peer dependency "react@^0.14.0 || ^15.0.0-0".
remote:        warning "react-social-icons@2.5.1" has unmet peer dependency "react@0.13.x || 0.14.x || 15.x.x".
remote:        warning "react-tap-event-plugin@2.0.1" has unmet peer dependency "react@^15.4.0-0".
remote:        warning "react-tap-event-plugin@2.0.1" has unmet peer dependency "react-dom@^15.4.0-0".
remote:        warning "react-test-renderer@15.4.2" has unmet peer dependency "react@^15.4.2".
remote:        warning "request-promise@4.1.1" has unmet peer dependency "request@^2.34".
remote:        warning "enzyme@2.7.1" has unmet peer dependency "react@0.13.x || 0.14.x || ^15.0.0-0 || 15.x".
remote:        warning "eslint-config-airbnb@14.0.0" has incorrect peer dependency "eslint-plugin-jsx-a11y@^3.0.2".
remote:        warning "react-addons-test-utils@15.4.2" has unmet peer dependency "react-dom@^15.4.2".
remote:        warning "react-addons-create-fragment@15.4.2" has unmet peer dependency "react@^15.4.2".
remote:        warning "react-event-listener@0.4.1" has unmet peer dependency "react@^0.14.0 || ^15.0.0".
remote:        warning "recompose@0.21.2" has unmet peer dependency "react@^0.14.0 || ^15.0.0".
remote:        warning "glob-promise@3.1.0" has unmet peer dependency "glob@*".
remote:        warning "request-promise-core@1.1.1" has unmet peer dependency "request@^2.34".
remote:        warning "react-addons-shallow-compare@15.4.2" has unmet peer dependency "react@^15.4.2".
remote:        [4/4] Building fresh packages...
remote:        $ heroku-nextjs-build
remote:
remote:        > commandiv-next@1.0.0 build /app/nextjs
remote:        > next build
remote:
remote:        > Using external babel configuration
remote:        > location: "/app/nextjs/.babelrc"
remote:        > Using "webpack" config function defined in next.config.js.
remote:        { Error: ./~/object.entries/index.js
remote:        Module not found: Error: Can't resolve 'define-properties' in '/app/nextjs/node_modules/object.entries'
remote:        resolve 'define-properties' in '/app/nextjs/node_modules/object.entries'
remote:        Parsed request is a module
remote:        using description file: /app/nextjs/node_modules/object.entries/package.json (relative path: .)
remote:        Field 'browser' doesn't contain a valid alias configuration
remote:        after using description file: /app/nextjs/node_modules/object.entries/package.json (relative path: .)
remote:        resolve as module
remote:        /app/nextjs/node_modules/node_modules doesn't exist or is not a directory
remote:        /app/node_modules doesn't exist or is not a directory
remote:        /node_modules doesn't exist or is not a directory
remote:        /app/nextjs/node_modules/object.entries/node_modules doesn't exist or is not a directory
remote:        looking for modules in /app/nextjs/node_modules/next/node_modules
remote:        using description file: /app/nextjs/node_modules/next/package.json (relative path: ./node_modules)
remote:        Field 'browser' doesn't contain a valid alias configuration
remote:        after using description file: /app/nextjs/node_modules/next/package.json (relative path: ./node_modules)
remote:        using description file: /app/nextjs/node_modules/next/package.json (relative path: ./node_modules/define-properties)
remote:        as directory
remote:        /app/nextjs/node_modules/next/node_modules/define-properties doesn't exist
remote:        no extension
remote:        Field 'browser' doesn't contain a valid alias configuration
remote:        /app/nextjs/node_modules/next/node_modules/define-properties doesn't exist
remote:        .js
remote:        Field 'browser' doesn't contain a valid alias configuration
remote:        /app/nextjs/node_modules/next/node_modules/define-properties.js doesn't exist
remote:        .json
remote:        Field 'browser' doesn't contain a valid alias configuration
remote:        /app/nextjs/node_modules/next/node_modules/define-properties.json doesn't exist
remote:        looking for modules in /app/nextjs/node_modules
remote:        using description file: /app/nextjs/package.json (relative path: ./node_modules)
remote:        Field 'browser' doesn't contain a valid alias configuration
remote:        after using description file: /app/nextjs/package.json (relative path: ./node_modules)
remote:        using description file: /app/nextjs/package.json (relative path: ./node_modules/define-properties)
remote:        as directory
remote:        /app/nextjs/node_modules/define-properties doesn't exist
remote:        no extension
remote:        Field 'browser' doesn't contain a valid alias configuration
remote:        /app/nextjs/node_modules/define-properties doesn't exist
remote:        .js
remote:        Field 'browser' doesn't contain a valid alias configuration
remote:        /app/nextjs/node_modules/define-properties.js doesn't exist
remote:        .json
remote:        Field 'browser' doesn't contain a valid alias configuration
remote:        /app/nextjs/node_modules/define-properties.json doesn't exist
remote:        [/app/nextjs/node_modules/node_modules]
remote:        [/app/node_modules]
remote:        [/node_modules]
remote:        [/app/nextjs/node_modules/object.entries/node_modules]
remote:        [/app/nextjs/node_modules/next/node_modules/define-properties]
remote:        [/app/nextjs/node_modules/next/node_modules/define-properties]
remote:        [/app/nextjs/node_modules/next/node_modules/define-properties.js]
remote:        [/app/nextjs/node_modules/next/node_modules/define-properties.json]
remote:        [/app/nextjs/node_modules/define-properties]
remote:        [/app/nextjs/node_modules/define-properties]
remote:        [/app/nextjs/node_modules/define-properties.js]
remote:        [/app/nextjs/node_modules/define-properties.json]
remote:        @ ./~/object.entries/index.js 3:13-41
remote:        @ ./~/styled-jsx/dist/render.js
remote:        @ ./~/styled-jsx/dist/style.js
remote:        @ ./~/styled-jsx/style.js
remote:        @ ./~/next/dist/pages/_error.js?entry
remote:        @ multi ./~/next/dist/pages/_error.js?entry
remote:        at /app/nextjs/node_modules/next/dist/server/build/index.js:122:21
remote:        at /app/nextjs/node_modules/next/node_modules/webpack/lib/Compiler.js:256:15
remote:        at Compiler.emitRecords (/app/nextjs/node_modules/next/node_modules/webpack/lib/Compiler.js:351:37)
remote:        at /app/nextjs/node_modules/next/node_modules/webpack/lib/Compiler.js:249:12
remote:        at /app/nextjs/node_modules/next/node_modules/webpack/lib/Compiler.js:344:11
remote:        at next (/app/nextjs/node_modules/next/node_modules/tapable/lib/Tapable.js:154:11)
remote:        at Compiler.compiler.plugin (/app/nextjs/node_modules/next/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
remote:        at Compiler.applyPluginsAsyncSeries1 (/app/nextjs/node_modules/next/node_modules/tapable/lib/Tapable.js:158:13)
remote:        at Compiler.afterEmit (/app/nextjs/node_modules/next/node_modules/webpack/lib/Compiler.js:341:8)
remote:        at Compiler.<anonymous> (/app/nextjs/node_modules/next/node_modules/webpack/lib/Compiler.js:336:14)
remote:        errors:
remote:        [ './~/object.entries/index.jsnModule not found: Error: Can't resolve 'define-properties' in '/app/nextjs/node_modules/object.entries'nresolve 'define-properties' in '/app/nextjs/node_modules/object.entries'n  Parsed request is a modulen  using description file: /app/nextjs/node_modules/object.entries/package.json (relative path: .)n    Field 'browser' doesn't contain a valid alias configurationn  after using description file: /app/nextjs/node_modules/object.entries/package.json (relative path: .)n    resolve as modulen      /app/nextjs/node_modules/node_modules doesn't exist or is not a directoryn      /app/node_modules doesn't exist or is not a directoryn      /node_modules doesn't exist or is not a directoryn      /app/nextjs/node_modules/object.entries/node_modules doesn't exist or is not a directoryn      looking for modules in /app/nextjs/node_modules/next/node_modulesn        using description file: /app/nextjs/node_modules/next/package.json (relative path: ./node_modules)n          Field 'browser' doesn't contain a valid alias configurationn        after using description file: /app/nextjs/node_modules/next/package.json (relative path: ./node_modules)n          using description file: /app/nextjs/node_modules/next/package.json (relative path: ./node_modules/define-properties)n            as directoryn              /app/nextjs/node_modules/next/node_modules/define-properties doesn't existn            no extensionn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/next/node_modules/define-properties doesn't existn            .jsn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/next/node_modules/define-properties.js doesn't existn            .jsonn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/next/node_modules/define-properties.json doesn't existn      looking for modules in /app/nextjs/node_modulesn        using description file: /app/nextjs/package.json (relative path: ./node_modules)n          Field 'browser' doesn't contain a valid alias configurationn        after using description file: /app/nextjs/package.json (relative path: ./node_modules)n          using description file: /app/nextjs/package.json (relative path: ./node_modules/define-properties)n            as directoryn              /app/nextjs/node_modules/define-properties doesn't existn            no extensionn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/define-properties doesn't existn            .jsn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/define-properties.js doesn't existn            .jsonn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/define-properties.json doesn't existn[/app/nextjs/node_modules/node_modules]n[/app/node_modules]n[/node_modules]n[/app/nextjs/node_modules/object.entries/node_modules]n[/app/nextjs/node_modules/next/node_modules/define-properties]n[/app/nextjs/node_modules/next/node_modules/define-properties]n[/app/nextjs/node_modules/next/node_modules/define-properties.js]n[/app/nextjs/node_modules/next/node_modules/define-properties.json]n[/app/nextjs/node_modules/define-properties]n[/app/nextjs/node_modules/define-properties]n[/app/nextjs/node_modules/define-properties.js]n[/app/nextjs/node_modules/define-properties.json]n @ ./~/object.entries/index.js 3:13-41n @ ./~/styled-jsx/dist/render.jsn @ ./~/styled-jsx/dist/style.jsn @ ./~/styled-jsx/style.jsn @ ./~/next/dist/pages/_error.js?entryn @ multi ./~/next/dist/pages/_error.js?entry',
remote:        './~/object.entries/shim.jsnModule not found: Error: Can't resolve 'define-properties' in '/app/nextjs/node_modules/object.entries'nresolve 'define-properties' in '/app/nextjs/node_modules/object.entries'n  Parsed request is a modulen  using description file: /app/nextjs/node_modules/object.entries/package.json (relative path: .)n    Field 'browser' doesn't contain a valid alias configurationn  after using description file: /app/nextjs/node_modules/object.entries/package.json (relative path: .)n    resolve as modulen      /app/nextjs/node_modules/object.entries/node_modules doesn't exist or is not a directoryn      /app/nextjs/node_modules/node_modules doesn't exist or is not a directoryn      /app/node_modules doesn't exist or is not a directoryn      /node_modules doesn't exist or is not a directoryn      looking for modules in /app/nextjs/node_modules/next/node_modulesn        using description file: /app/nextjs/node_modules/next/package.json (relative path: ./node_modules)n          Field 'browser' doesn't contain a valid alias configurationn        after using description file: /app/nextjs/node_modules/next/package.json (relative path: ./node_modules)n          using description file: /app/nextjs/node_modules/next/package.json (relative path: ./node_modules/define-properties)n            no extensionn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/next/node_modules/define-properties doesn't existn            .jsn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/next/node_modules/define-properties.js doesn't existn            .jsonn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/next/node_modules/define-properties.json doesn't existn            as directoryn              /app/nextjs/node_modules/next/node_modules/define-properties doesn't existn      looking for modules in /app/nextjs/node_modulesn        using description file: /app/nextjs/package.json (relative path: ./node_modules)n          Field 'browser' doesn't contain a valid alias configurationn        after using description file: /app/nextjs/package.json (relative path: ./node_modules)n          using description file: /app/nextjs/package.json (relative path: ./node_modules/define-properties)n            no extensionn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/define-properties doesn't existn            .jsn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/define-properties.js doesn't existn            .jsonn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/define-properties.json doesn't existn            as directoryn              /app/nextjs/node_modules/define-properties doesn't existn[/app/nextjs/node_modules/object.entries/node_modules]n[/app/nextjs/node_modules/node_modules]n[/app/node_modules]n[/node_modules]n[/app/nextjs/node_modules/next/node_modules/define-properties]n[/app/nextjs/node_modules/next/node_modules/define-properties.js]n[/app/nextjs/node_modules/next/node_modules/define-properties.json]n[/app/nextjs/node_modules/next/node_modules/define-properties]n[/app/nextjs/node_modules/define-properties]n[/app/nextjs/node_modules/define-properties.js]n[/app/nextjs/node_modules/define-properties.json]n[/app/nextjs/node_modules/define-properties]n @ ./~/object.entries/shim.js 4:13-41n @ ./~/object.entries/index.jsn @ ./~/styled-jsx/dist/render.jsn @ ./~/styled-jsx/dist/style.jsn @ ./~/styled-jsx/style.jsn @ ./~/next/dist/pages/_error.js?entryn @ multi ./~/next/dist/pages/_error.js?entry',
remote:        './~/object.entries/implementation.jsnModule not found: Error: Can't resolve 'has' in '/app/nextjs/node_modules/object.entries'nresolve 'has' in '/app/nextjs/node_modules/object.entries'n  Parsed request is a modulen  using description file: /app/nextjs/node_modules/object.entries/package.json (relative path: .)n    Field 'browser' doesn't contain a valid alias configurationn  after using description file: /app/nextjs/node_modules/object.entries/package.json (relative path: .)n    resolve as modulen      /app/nextjs/node_modules/object.entries/node_modules doesn't exist or is not a directoryn      /app/nextjs/node_modules/node_modules doesn't exist or is not a directoryn      /app/node_modules doesn't exist or is not a directoryn      /node_modules doesn't exist or is not a directoryn      looking for modules in /app/nextjs/node_modules/next/node_modulesn        using description file: /app/nextjs/node_modules/next/package.json (relative path: ./node_modules)n          Field 'browser' doesn't contain a valid alias configurationn        after using description file: /app/nextjs/node_modules/next/package.json (relative path: ./node_modules)n          using description file: /app/nextjs/node_modules/next/package.json (relative path: ./node_modules/has)n            as directoryn              /app/nextjs/node_modules/next/node_modules/has doesn't existn            no extensionn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/next/node_modules/has doesn't existn            .jsn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/next/node_modules/has.js doesn't existn            .jsonn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/next/node_modules/has.json doesn't existn      looking for modules in /app/nextjs/node_modulesn        using description file: /app/nextjs/package.json (relative path: ./node_modules)n          Field 'browser' doesn't contain a valid alias configurationn        after using description file: /app/nextjs/package.json (relative path: ./node_modules)n          using description file: /app/nextjs/package.json (relative path: ./node_modules/has)n            as directoryn              /app/nextjs/node_modules/has doesn't existn            no extensionn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/has doesn't existn            .jsn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/has.js doesn't existn            .jsonn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/has.json doesn't existn[/app/nextjs/node_modules/object.entries/node_modules]n[/app/nextjs/node_modules/node_modules]n[/app/node_modules]n[/node_modules]n[/app/nextjs/node_modules/next/node_modules/has]n[/app/nextjs/node_modules/next/node_modules/has]n[/app/nextjs/node_modules/next/node_modules/has.js]n[/app/nextjs/node_modules/next/node_modules/has.json]n[/app/nextjs/node_modules/has]n[/app/nextjs/node_modules/has]n[/app/nextjs/node_modules/has.js]n[/app/nextjs/node_modules/has.json]n @ ./~/object.entries/implementation.js 4:10-24n @ ./~/object.entries/index.jsn @ ./~/styled-jsx/dist/render.jsn @ ./~/styled-jsx/dist/style.jsn @ ./~/styled-jsx/style.jsn @ ./~/next/dist/pages/_error.js?entryn @ multi ./~/next/dist/pages/_error.js?entry',
remote:        './~/object.entries/implementation.jsnModule not found: Error: Can't resolve 'function-bind' in '/app/nextjs/node_modules/object.entries'nresolve 'function-bind' in '/app/nextjs/node_modules/object.entries'n  Parsed request is a modulen  using description file: /app/nextjs/node_modules/object.entries/package.json (relative path: .)n    Field 'browser' doesn't contain a valid alias configurationn  after using description file: /app/nextjs/node_modules/object.entries/package.json (relative path: .)n    resolve as modulen      /app/nextjs/node_modules/object.entries/node_modules doesn't exist or is not a directoryn      /app/nextjs/node_modules/node_modules doesn't exist or is not a directoryn      /app/node_modules doesn't exist or is not a directoryn      /node_modules doesn't exist or is not a directoryn      looking for modules in /app/nextjs/node_modules/next/node_modulesn        using description file: /app/nextjs/node_modules/next/package.json (relative path: ./node_modules)n          Field 'browser' doesn't contain a valid alias configurationn        after using description file: /app/nextjs/node_modules/next/package.json (relative path: ./node_modules)n          using description file: /app/nextjs/node_modules/next/package.json (relative path: ./node_modules/function-bind)n            as directoryn              /app/nextjs/node_modules/next/node_modules/function-bind doesn't existn            no extensionn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/next/node_modules/function-bind doesn't existn            .jsn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/next/node_modules/function-bind.js doesn't existn            .jsonn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/next/node_modules/function-bind.json doesn't existn      looking for modules in /app/nextjs/node_modulesn        using description file: /app/nextjs/package.json (relative path: ./node_modules)n          Field 'browser' doesn't contain a valid alias configurationn        after using description file: /app/nextjs/package.json (relative path: ./node_modules)n          using description file: /app/nextjs/package.json (relative path: ./node_modules/function-bind)n            as directoryn              /app/nextjs/node_modules/function-bind doesn't existn            no extensionn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/function-bind doesn't existn            .jsn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/function-bind.js doesn't existn            .jsonn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/function-bind.json doesn't existn[/app/nextjs/node_modules/object.entries/node_modules]n[/app/nextjs/node_modules/node_modules]n[/app/node_modules]n[/node_modules]n[/app/nextjs/node_modules/next/node_modules/function-bind]n[/app/nextjs/node_modules/next/node_modules/function-bind]n[/app/nextjs/node_modules/next/node_modules/function-bind.js]n[/app/nextjs/node_modules/next/node_modules/function-bind.json]n[/app/nextjs/node_modules/function-bind]n[/app/nextjs/node_modules/function-bind]n[/app/nextjs/node_modules/function-bind.js]n[/app/nextjs/node_modules/function-bind.json]n @ ./~/object.entries/implementation.js 5:11-35n @ ./~/object.entries/index.jsn @ ./~/styled-jsx/dist/render.jsn @ ./~/styled-jsx/dist/style.jsn @ ./~/styled-jsx/style.jsn @ ./~/next/dist/pages/_error.js?entryn @ multi ./~/next/dist/pages/_error.js?entry',
remote:        './~/object.entries/implementation.jsnModule not found: Error: Can't resolve 'es-abstract/es7' in '/app/nextjs/node_modules/object.entries'nresolve 'es-abstract/es7' in '/app/nextjs/node_modules/object.entries'n  Parsed request is a modulen  using description file: /app/nextjs/node_modules/object.entries/package.json (relative path: .)n    Field 'browser' doesn't contain a valid alias configurationn  after using description file: /app/nextjs/node_modules/object.entries/package.json (relative path: .)n    resolve as modulen      /app/nextjs/node_modules/object.entries/node_modules doesn't exist or is not a directoryn      /app/nextjs/node_modules/node_modules doesn't exist or is not a directoryn      /app/node_modules doesn't exist or is not a directoryn      /node_modules doesn't exist or is not a directoryn      looking for modules in /app/nextjs/node_modules/next/node_modulesn        using description file: /app/nextjs/node_modules/next/package.json (relative path: ./node_modules)n          Field 'browser' doesn't contain a valid alias configurationn        after using description file: /app/nextjs/node_modules/next/package.json (relative path: ./node_modules)n          using description file: /app/nextjs/node_modules/next/package.json (relative path: ./node_modules/es-abstract/es7)n            as directoryn              /app/nextjs/node_modules/next/node_modules/es-abstract/es7 doesn't existn            no extensionn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/next/node_modules/es-abstract/es7 doesn't existn            .jsn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/next/node_modules/es-abstract/es7.js doesn't existn            .jsonn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/next/node_modules/es-abstract/es7.json doesn't existn      looking for modules in /app/nextjs/node_modulesn        using description file: /app/nextjs/package.json (relative path: ./node_modules)n          Field 'browser' doesn't contain a valid alias configurationn        after using description file: /app/nextjs/package.json (relative path: ./node_modules)n          using description file: /app/nextjs/package.json (relative path: ./node_modules/es-abstract/es7)n            as directoryn              /app/nextjs/node_modules/es-abstract/es7 doesn't existn            no extensionn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/es-abstract/es7 doesn't existn            .jsn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/es-abstract/es7.js doesn't existn            .jsonn              Field 'browser' doesn't contain a valid alias configurationn              /app/nextjs/node_modules/es-abstract/es7.json doesn't existn[/app/nextjs/node_modules/object.entries/node_modules]n[/app/nextjs/node_modules/node_modules]n[/app/node_modules]n[/node_modules]n[/app/nextjs/node_modules/next/node_modules/es-abstract/es7]n[/app/nextjs/node_modules/next/node_modules/es-abstract/es7]n[/app/nextjs/node_modules/next/node_modules/es-abstract/es7.js]n[/app/nextjs/node_modules/next/node_modules/es-abstract/es7.json]n[/app/nextjs/node_modules/es-abstract/es7]n[/app/nextjs/node_modules/es-abstract/es7]n[/app/nextjs/node_modules/es-abstract/es7.js]n[/app/nextjs/node_modules/es-abstract/es7.json]n @ ./~/object.entries/implementation.js 3:9-35n @ ./~/object.entries/index.jsn @ ./~/styled-jsx/dist/render.jsn @ ./~/styled-jsx/dist/style.jsn @ ./~/styled-jsx/style.jsn @ ./~/next/dist/pages/_error.js?entryn @ multi ./~/next/dist/pages/_error.js?entry' ],
remote:        warnings: [] }
remote:
remote:        npm ERR! Linux 3.13.0-105-generic
remote:        npm ERR! argv "/tmp/build_cf9c195f7ffff73026d77d9ea5658311/.heroku/node/bin/node" "/tmp/build_cf9c195f7ffff73026d77d9ea5658311/.heroku/node/bin/npm" "run" "build"
remote:        npm ERR! node v6.9.5
remote:        npm ERR! npm  v3.10.10
remote:        npm ERR! code ELIFECYCLE
remote:        npm ERR! commandiv-next@1.0.0 build: `next build`
remote:        npm ERR! Exit status 1
remote:        npm ERR!
remote:        npm ERR! Failed at the commandiv-next@1.0.0 build script 'next build'.
remote:        npm ERR! Make sure you have the latest version of node.js and npm installed.
remote:        npm ERR! If you do, this is most likely a problem with the commandiv-next package,
remote:        npm ERR! not with npm itself.
remote:        npm ERR! Tell the author that this fails on your system:
remote:        npm ERR!     next build
remote:        npm ERR! You can get information on how to open an issue for this project with:
remote:        npm ERR!     npm bugs commandiv-next
remote:        npm ERR! Or if that isn't available, you can get their info via:
remote:        npm ERR!     npm owner ls commandiv-next
remote:        npm ERR! There is likely additional logging output above.
remote:
remote:        npm ERR! Please include the following file with any support request:
remote:        npm ERR!     /app/nextjs/npm-debug.log
remote:        error Command failed with exit code 1.
remote:        info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
remote:
remote: -----> Build failed
remote:
remote:        We're sorry this build is failing! You can troubleshoot common issues here:
remote:        https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote:        Some possible problems:
remote:
remote:        - This project was built with yarn, which is new and under development. Some projects can still be built more reliably with npm
remote:        https://devcenter.heroku.com/articles/nodejs-support#build-behavior
remote:
remote:        Love,
remote:        Heroku
remote:
remote:  !     Push rejected, failed to compile Node.js app.
remote:
remote:  !     Push failed
remote: Verifying deploy....
remote:
remote: !   Push rejected to commandiv.
remote:
To https://git.heroku.com/commandiv.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/commandiv.git

.babelrc

{
  "plugins": [
    [
      "wrap-in-js",
      {
        "extensions": ["css$", "scss$"]
      }
    ],
    ["babel-root-import",
      {
        "rootPathPrefix": "@"
      }
    ]
  ],
  "presets": [
    "next/babel",
    "es2015"
  ],
  "ignore": []
}

next.config.js

module.exports = {
  webpack: (config, { dev }) => {
    config.module.rules.push(
      {
        test: /\.(css|scss)/,
        loader: "emit-file-loader",
        options: {
          name: 'dist/[path][name].[ext]'
        }
      }
    ,
      {
        test: /\.css$/,
        loader: "babel-loader!raw-loader"
      }
    ,
      {
        test: /\.scss$/,
        loader: "babel-loader!raw-loader!sass-loader"
      }
    )
    return config
  }
}
tgoldenberg commented 7 years ago

Here is the repo that may be causing it - babel-root-import

tgoldenberg commented 7 years ago

and the package.json:

{
  "name": "commandiv-next",
  "version": "1.0.0",
  "description": "Commandiv Marketing website",
  "scripts": {
    "test": "jest __tests__/*",
    "build": "next build",
    "start": "NODE_ENV=production node server/ -p $PORT",
    "dev": "node server/index.js",
    "postinstall": "heroku-nextjs-build"
  },
  "author": "tgoldenberg",
  "dependencies": {
    "@mars/heroku-nextjs-build": "^1.1.0",
    "babel-plugin-syntax-async-functions": "^6.13.0",
    "babel-plugin-transform-flow-strip-types": "^6.22.0",
    "babel-plugin-transform-regenerator": "^6.22.0",
    "babel-plugin-wrap-in-js": "^1.1.1",
    "babel-polyfill": "^6.22.0",
    "babel-preset-airbnb": "^2.2.3",
    "babel-preset-es2015": "^6.22.0",
    "babel-preset-react": "^6.22.0",
    "babel-register": "^6.22.0",
    "babel-root-import": "^4.1.5",
    "body-parser": "^1.16.0",
    "code-point-at": "^1.1.0",
    "crypto": "^0.0.3",
    "dotenv": "^4.0.0",
    "express": "^4.14.1",
    "fs": "^0.0.1-security",
    "http": "^0.0.0",
    "https": "^1.0.0",
    "lodash": "^4.17.4",
    "mailchimp-api-v3": "^1.7.0",
    "mandrill-api": "^1.0.45",
    "material-ui": "^0.16.7",
    "mongoose": "^4.8.1",
    "morgan": "^1.8.0",
    "next": "beta",
    "node-sass": "latest",
    "raw-loader": "^0.5.1",
    "react-addons-css-transition-group": "^15.4.2",
    "react-addons-pure-render-mixin": "^15.4.2",
    "react-addons-transition-group": "^15.4.2",
    "react-ga": "^2.1.2",
    "react-redux": "^5.0.2",
    "react-social-icons": "^2.5.1",
    "react-tap-event-plugin": "^2.0.1",
    "react-test-renderer": "^15.4.2",
    "redux": "^3.6.0",
    "redux-thunk": "^2.2.0",
    "request-promise": "^4.1.1",
    "sass-loader": "^4.1.1",
    "webpack": "^1.14.0"
  },
  "engines": {
    "node": "6.9.x"
  },
  "cacheDirectories": [
    "nextjs/node_modules"
  ],
  "devDependencies": {
    "babel": "^6.5.2",
    "babel-eslint": "^7.1.1",
    "babel-jest": "^18.0.0",
    "babel-plugin-syntax-async-functions": "^6.13.0",
    "babel-plugin-transform-flow-strip-types": "^6.22.0",
    "babel-plugin-transform-regenerator": "^6.22.0",
    "babel-polyfill": "^6.22.0",
    "babel-preset-airbnb": "^2.2.3",
    "babel-preset-es2015": "^6.22.0",
    "babel-preset-react": "^6.22.0",
    "babel-root-import": "^4.1.5",
    "enzyme": "^2.7.1",
    "eslint": "^3.15.0",
    "eslint-config-airbnb": "^14.0.0",
    "eslint-plugin-import": "^2.2.0",
    "eslint-plugin-jsx-a11y": "^4.0.0",
    "eslint-plugin-react": "^6.9.0",
    "flow-bin": "^0.38.0",
    "jest": "^18.1.0",
    "jest-cli": "^18.1.0",
    "react-addons-test-utils": "^15.4.2"
  }
}
tgoldenberg commented 7 years ago

It also does this, if I remove code-point-at. Really strange behavior, but works fine locally...

Counting objects: 158, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (155/155), done.
Writing objects: 100% (158/158), 56.50 KiB | 0 bytes/s, done.
Total 158 (delta 92), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        NPM_CONFIG_PRODUCTION=true
remote:        NODE_VERBOSE=false
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote:        engines.node (package.json):  6.9.x
remote:        engines.npm (package.json):   unspecified (use default)
remote:
remote:        Resolving node version 6.9.x via semver.io...
remote:        Downloading and installing node 6.9.5...
remote:        Using default npm version: 3.10.10
remote:        Resolving yarn version (latest) via semver.io...
remote:        Downloading and installing yarn (0.19.1)...
remote:        Installed yarn 0.19.1
remote:
remote: -----> Restoring cache
remote:        Loading 1 from cacheDirectories (package.json):
remote:        - nextjs/node_modules
remote:
remote: -----> Building dependencies
remote:        Installing node modules (yarn.lock)
remote:        yarn install v0.19.1
remote:        warning commandiv-next@1.0.0: No license field
remote:        [1/4] Resolving packages...
remote:        [2/4] Fetching packages...
remote:        warning fsevents@1.0.17: The platform "linux" is incompatible with this module.
remote:        info "fsevents@1.0.17" is an optional dependency and failed compatibility check. Excluding it from installation.
remote:        [3/4] Linking dependencies...
remote:        warning "material-ui@0.16.7" has unmet peer dependency "react@^15.0.0".
remote:        warning "material-ui@0.16.7" has unmet peer dependency "react-dom@^15.0.0".
remote:        warning "react-addons-css-transition-group@15.4.2" has unmet peer dependency "react@^15.4.2".
remote:        warning "react-addons-pure-render-mixin@15.4.2" has unmet peer dependency "react@^15.4.2".
remote:        warning "react-addons-transition-group@15.4.2" has unmet peer dependency "react@^15.4.2".
remote:        warning "react-ga@2.1.2" has unmet peer dependency "react@>= 0.14.0".
remote:        warning "react-redux@5.0.2" has unmet peer dependency "react@^0.14.0 || ^15.0.0-0".
remote:        warning "react-social-icons@2.5.1" has unmet peer dependency "react@0.13.x || 0.14.x || 15.x.x".
remote:        warning "react-tap-event-plugin@2.0.1" has unmet peer dependency "react@^15.4.0-0".
remote:        warning "react-tap-event-plugin@2.0.1" has unmet peer dependency "react-dom@^15.4.0-0".
remote:        warning "react-test-renderer@15.4.2" has unmet peer dependency "react@^15.4.2".
remote:        warning "request-promise@4.1.1" has unmet peer dependency "request@^2.34".
remote:        warning "enzyme@2.7.1" has unmet peer dependency "react@0.13.x || 0.14.x || ^15.0.0-0 || 15.x".
remote:        warning "eslint-config-airbnb@14.0.0" has incorrect peer dependency "eslint-plugin-jsx-a11y@^3.0.2".
remote:        warning "react-addons-test-utils@15.4.2" has unmet peer dependency "react-dom@^15.4.2".
remote:        warning "react-addons-create-fragment@15.4.2" has unmet peer dependency "react@^15.4.2".
remote:        warning "react-event-listener@0.4.1" has unmet peer dependency "react@^0.14.0 || ^15.0.0".
remote:        warning "recompose@0.21.2" has unmet peer dependency "react@^0.14.0 || ^15.0.0".
remote:        warning "glob-promise@3.1.0" has unmet peer dependency "glob@*".
remote:        warning "request-promise-core@1.1.1" has unmet peer dependency "request@^2.34".
remote:        warning "react-addons-shallow-compare@15.4.2" has unmet peer dependency "react@^15.4.2".
remote:        [4/4] Building fresh packages...
remote:        error /tmp/build_ef8043c43a4514b067bb67d7caa2afe4/node_modules/node-sass: Command failed.
remote:        Exit code: 1
remote:        Command: sh
remote:        Arguments: -c node scripts/install.js
remote:        Directory: /tmp/build_ef8043c43a4514b067bb67d7caa2afe4/node_modules/node-sass
remote:        Output:
remote:        module.js:471
remote:        throw err;
remote:        ^
remote:
remote:        Error: Cannot find module 'code-point-at'
remote:        at Function.Module._resolveFilename (module.js:469:15)
remote:        at Function.Module._load (module.js:417:25)
remote:        at Module.require (module.js:497:17)
remote:        at require (internal/module.js:20:19)
remote:        at Object.<anonymous> (/tmp/build_ef8043c43a4514b067bb67d7caa2afe4/node_modules/string-width/index.js:3:19)
remote:        at Module._compile (module.js:570:32)
remote:        at Object.Module._extensions..js (module.js:579:10)
remote:        at Module.load (module.js:487:32)
remote:        at tryModuleLoad (module.js:446:12)
remote:        at Function.Module._load (module.js:438:3)
remote:        info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
remote:
remote: -----> Build failed
remote:
remote:        We're sorry this build is failing! You can troubleshoot common issues here:
remote:        https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote:        Some possible problems:
remote:
remote:        - A module may be missing from 'dependencies' in package.json
remote:        https://devcenter.heroku.com/articles/troubleshooting-node-deploys#ensure-you-aren-t-relying-on-untracked-dependencies
remote:
remote:        - This module may be specified in 'devDependencies' instead of 'dependencies'
remote:        https://devcenter.heroku.com/articles/nodejs-support#devdependencies
remote:
remote:        - This project was built with yarn, which is new and under development. Some projects can still be built more reliably with npm
remote:        https://devcenter.heroku.com/articles/nodejs-support#build-behavior
remote:
remote:        Love,
remote:        Heroku
remote:
remote:  !     Push rejected, failed to compile Node.js app.
remote:
remote:  !     Push failed
remote: Verifying deploy....
remote:
remote: !   Push rejected to commandiv.
remote:
To https://git.heroku.com/commandiv.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/commandiv.git'
tgoldenberg commented 7 years ago

Also tried yarn upgrade

mars commented 7 years ago

Hi @tgoldenberg,

I'm unfamiliar with the babel-root-imports so I can only offer hints as to what may be going wrong here. I see in the description the log lines where things start going wrong:

{ Error: ./~/object.entries/index.js
Module not found: Error: Can't resolve 'define-properties' in '/app/nextjs/node_modules/object.entries'

I'm suspicious of that ~/ which normally expands to the home directory path and then the /app/nextjs/node_modules/object.entries which is not found.

It seems likely to me that the technique used by those absolute imports does not cooperate with the filesystem workaround required for Next build on Heroku.

If you're determined to use root/absolute imports (understandable!) Then I can offer guidance following a technique I've used with great success. This technique requires configuring the default search path for modules twice:

  1. for the browser in the webpack config (requires Next 2.0) set resolve.modules to something like

    ["node_modules", path.resolve(__dirname, "components")]
  2. for the server in package.json, prefix scripts.start with a customized Node search path to something like

    NODE_PATH=$NODE_PATH:./components next start -p $PORT

Let me know how it goes 🤓

mars commented 7 years ago

After looking further at Webpack 2 (used by Next), I realize that my technique from Webpack 1 will not work anymore 😞 Webpack 1 had resolve.moduleDirectories which was analogous to Node's NODE_PATH variable, but that seems to no longer be the case. I can't say for sure without going through the process trying to solve this myself. I'll update again when/if I have more conclusive info.

tgoldenberg commented 7 years ago

@mars, I ended up ditching the attempt at using absolute imports. Also, and this really important to note, is that I could not deploy my app with Yarn. Just could not. Once I commited the yarn.lock file to my .gitignore file and removed it from the repo, the deployment went fine. This is a huge point that is very hard to debug. Closing this for now.

mars commented 7 years ago

Deploying w/ Yarn is supported. This yarn branch deploys to a Heroku app successfully on Next 1 and 2-beta. I don't think Yarn is the root problem here.

That Babel plugin uses paths.resolve() which seems suspect next to the build process which moves the build directory twice, filtering .dotfiles & .dotdirs along the way.

Confirm the app is using the newest Heroku build adapter 1.1.0 in package.json or yarn.lock.

Hopefully it will go smoothly now with npm & relative imports.

Leaving this open. babel-root-import plugin error is a bug. Not compatible until someone makes it otherwise 🌱

mars commented 7 years ago

Next resolved the underlying static path issue. The Heroku build adapter is no longer required, so if you upgrade to the most recent Next release and remove that heroku-postbuild script entry from package.json, I believe this issue will be solved.

tgoldenberg commented 7 years ago

Update: I have been using the babel-root-import plugin with success along with this package. The most recent version of Next.js caused a minor bug, but @arunoda was able to provide a workaround. Thanks!