前提摘要
- 构建项目使用官方
vue init nuxt-community/starter-template <project-name>
方法创建的nuxt项目 - 本地开发无问题
- npm run build及 npm start部署到now.sh无问题
错误产生
本地执行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
补充说明:原以为是动态路由配置存在问题报错,但将所有动态路由去掉之后还是报相同错误,排除此可能。
求救!!!
./nuxt.config.js
这样就好了