鍍金池/ 問答/HTML/ nuxt generate 報錯,生成dist文件夾中未生成index.html

nuxt generate 報錯,生成dist文件夾中未生成index.html

前提摘要

  1. 構(gòu)建項目使用官方vue init nuxt-community/starter-template <project-name>方法創(chuàng)建的nuxt項目
  2. 本地開發(fā)無問題
  3. npm run build及 npm start部署到now.sh無問題

錯誤產(chǎn)生

本地執(zhí)行npm run generate報錯:

{ Error: ENOENT: no such file or directory, lstat '/Users/casen/worker/webFile/nuxt/nuxtStarterTest/dist/index.html'
    at Error (native)
  errno: -2,
  code: 'ENOENT',
  syscall: 'lstat',
  path: '/Users/casen/worker/webFile/nuxt/nuxtStarterTest/dist/index.html' }

npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "generate"
npm ERR! node v6.10.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! nuxt_starter_test@1.0.0 generate: `nuxt generate`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the nuxt_starter_test@1.0.0 generate script 'nuxt generate'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the nuxt_starter_test package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     nuxt generate
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs nuxt_starter_test
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls nuxt_starter_test
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/casen/worker/webFile/nuxt/nuxtStarterTest/npm-debug.log

且生成文件dist中無index.html

補充說明:原以為是動態(tài)路由配置存在問題報錯,但將所有動態(tài)路由去掉之后還是報相同錯誤,排除此可能。

求救!??!

回答
編輯回答
離人歸

你這個問題解決了嗎?

我也遇到這個問題,去 GitHub 的 issues 里面也沒找到類似的問題,懷疑是新版本更新的 bug

2017年12月7日 12:49
編輯回答
還吻

我今天也遇到這個問題了,請問找到解決辦法了嗎?

2017年3月7日 22:11