NuxtJS + Netlify, `npm run generate` doesn't create `index.html`

Good day to Netlify team!

I’m currently building my portfolio site using full static NuxtJS mode. It works fine on my local machine.

However, when I tried to deploy on Netlify, it shows a 404 page.

After I’ve examined further from the build .zip, it seems that npm run generate script ran by Netlify doesn’t generate index.html.

My build command is npm run generate as suggested by this and my public directory is set to dist

You can find the repository here

Does npm run generate work on your local machine from the root directory of your project? Can you post the build log as well?

npm run generate works perfectly on my local machine from the root directory.

Here’s the build log

9:13:50 AM: Build ready to start
9:13:52 AM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6
9:13:52 AM: build-image tag: v3.4.1
9:13:52 AM: buildbot version: 8c957a6d09a03023cea4239847cc73a9cb64eeb7
9:13:53 AM: Building without cache
9:13:53 AM: Starting to prepare the repo for build
9:13:53 AM: No cached dependencies found. Cloning fresh repo
9:13:53 AM: git clone https://github.com/Namchee/namchee-site
9:13:54 AM: Preparing Git Reference refs/heads/master
9:13:56 AM: Starting build script
9:13:56 AM: Installing dependencies
9:13:56 AM: Python version set to 2.7
9:13:57 AM: Downloading and installing node v12.18.3...
9:13:57 AM: Downloading https://nodejs.org/dist/v12.18.3/node-v12.18.3-linux-x64.tar.xz...
9:13:58 AM: Computing checksum with sha256sum
9:13:58 AM: Checksums matched!
9:14:01 AM: Now using node v12.18.3 (npm v6.14.6)
9:14:01 AM: Started restoring cached build plugins
9:14:01 AM: Finished restoring cached build plugins
9:14:01 AM: Attempting ruby version 2.7.1, read from environment
9:14:03 AM: Using ruby version 2.7.1
9:14:03 AM: Using PHP version 5.6
9:14:03 AM: 5.2 is already installed.
9:14:03 AM: Using Swift version 5.2
9:14:03 AM: Started restoring cached node modules
9:14:03 AM: Finished restoring cached node modules
9:14:03 AM: Installing NPM modules using NPM version 6.14.6
9:14:37 AM: > core-js@2.6.11 postinstall /opt/build/repo/node_modules/core-js
9:14:37 AM: > node -e "try{require('./postinstall')}catch(e){}"
9:14:37 AM: > ejs@2.7.4 postinstall /opt/build/repo/node_modules/ejs
9:14:37 AM: > node ./postinstall.js
9:14:38 AM: > nuxt@2.14.5 postinstall /opt/build/repo/node_modules/nuxt
9:14:38 AM: > opencollective || exit 0
9:14:39 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
9:14:39 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
9:14:39 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/fsevents):
9:14:39 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
9:14:39 AM: added 1725 packages from 636 contributors and audited 1732 packages in 35.368s
9:14:40 AM: 62 packages are looking for funding
9:14:40 AM:   run `npm fund` for details
9:14:40 AM: found 2 high severity vulnerabilities
9:14:40 AM:   run `npm audit fix` to fix them, or `npm audit` for details
9:14:40 AM: NPM modules installed
9:14:41 AM: Started restoring cached go cache
9:14:41 AM: Finished restoring cached go cache
9:14:41 AM: go version go1.14.4 linux/amd64
9:14:41 AM: go version go1.14.4 linux/amd64
9:14:41 AM: Installing missing commands
9:14:41 AM: Verify run directory
9:14:42 AM: ​
9:14:42 AM: ┌─────────────────────────────┐
9:14:42 AM: │        Netlify Build        │
9:14:42 AM: └─────────────────────────────┘
9:14:42 AM: ​
9:14:42 AM: ❯ Version
9:14:42 AM:   @netlify/build 3.3.5
9:14:42 AM: ​
9:14:42 AM: ❯ Flags
9:14:42 AM:   deployId: 5f5c2ede495aeb4983c39d3c
9:14:42 AM:   mode: buildbot
9:14:42 AM: ​
9:14:42 AM: ❯ Current directory
9:14:42 AM:   /opt/build/repo
9:14:42 AM: ​
9:14:42 AM: ❯ Config file
9:14:42 AM:   /opt/build/repo/netlify.toml
9:14:42 AM: ​
9:14:42 AM: ❯ Context
9:14:42 AM:   production
9:14:42 AM: ​
9:14:42 AM: ┌────────────────────────────────────┐
9:14:42 AM: │ 1. build.command from netlify.toml │
9:14:42 AM: └────────────────────────────────────┘
9:14:42 AM: ​
9:14:42 AM: $ npm run generate
9:14:42 AM: > namchee@ generate /opt/build/repo
9:14:42 AM: > nuxt generate
9:15:12 AM: ​
9:15:12 AM: (build.command completed in 30.2s)
9:15:12 AM: ​
9:15:12 AM: ┌─────────────────────────────┐
9:15:12 AM: │   Netlify Build Complete    │
9:15:12 AM: └─────────────────────────────┘
9:15:12 AM: ​
9:15:12 AM: (Netlify Build completed in 30.2s)
9:15:12 AM: Caching artifacts
9:15:12 AM: Started saving node modules
9:15:12 AM: Finished saving node modules
9:15:12 AM: Started saving build plugins
9:15:12 AM: Finished saving build plugins
9:15:12 AM: Started saving pip cache
9:15:12 AM: Finished saving pip cache
9:15:12 AM: Started saving emacs cask dependencies
9:15:12 AM: Finished saving emacs cask dependencies
9:15:12 AM: Started saving maven dependencies
9:15:12 AM: Finished saving maven dependencies
9:15:12 AM: Started saving boot dependencies
9:15:12 AM: Finished saving boot dependencies
9:15:12 AM: Started saving go dependencies
9:15:12 AM: Finished saving go dependencies
9:15:17 AM: Build script success
9:15:17 AM: Starting to deploy site from 'dist'
9:15:17 AM: Creating deploy tree 
9:15:17 AM: Creating deploy upload records
9:15:17 AM: 6 new files to upload
9:15:17 AM: 0 new functions to upload
9:15:17 AM: Starting post processing
9:15:17 AM: Post processing - HTML
9:15:18 AM: Post processing - header rules
9:15:18 AM: Post processing - redirect rules
9:15:18 AM: Post processing done
9:15:18 AM: Site is live
9:15:46 AM: Finished processing build request in 1m53.767407982s

Hi @Namchee I noticed you named the entry point Index.vue instead of index.vue try changing it and see what happens.

Thank you for replying!

You are right! It seems that my git repository is broken somehow, gotta fix it later ASAP

1 Like