Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next build failed #3398

Closed
pthphap opened this issue Dec 5, 2017 · 0 comments · May be fixed by tverney/next.js#173, baby636/next.js#965, baby636/next.js#981, RiftNemesis/next.js#461 or RiftNemesis/next.js#463
Closed

Comments

@pthphap
Copy link

pthphap commented Dec 5, 2017

Hello, everyone, I'm about deploying my nextjs application to production, but I can not run build "npm run build" command which will run "next build"

Expected Behavior

A folder with random name is generated for production

Current Behavior

The first time, I got an error

{ Error: bundles/pages/collections/index.js from UglifyJs
Unexpected token: name (RequestError)

so I created next.config.js file with following contain:

const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
module.exports = {
    webpack: (config, { dev }) => {
        config.node = {
            fs: "empty"
        };
        config.plugins = [
            new UglifyJSPlugin()
        ]
        return config
    }
}

Then I ran it again, the bug was gone, but I got new error

{ Error: ENOENT: no such file or directory, open '/opt/www/eefd7f76-3b2c-4abe-b8d9-14399006a068/.next/app.js'
at Error (native)
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/opt/www/eefd7f76-3b2c-4abe-b8d9-14399006a068/.next/app.js' }

I've checked for it in eefd7f76-3b2c-4abe-b8d9-14399006a068 folder, there is no app.js file but a main.js file.

Why it looked for app.js but not main.js?

Here is the folder:
image

Your Environment

Tech Version
next 3.2.2
webpack 3.8.1
@lock lock bot locked as resolved and limited conversation to collaborators Mar 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.