adonuxt-template
adonuxt-template copied to clipboard
TypeError: Nuxt is not a constructor
Hi,
I am getting the error 'TypeError: Nuxt is not a constructor' on a fresh install when running 'npm run serve:dev'. Here are the steps I took:
-
Install Adonis - npm i -g adonis-cli
-
Create new install - adonis new --blueprint nuxt-community/adonuxt-template adonuxttest
-
cd adonuxttest
-
npm install
-
npm run serve:dev
This is the complete terminal output:
`> [email protected] serve:dev /Users/Dan/Projects/adonuxttest
npm run dev
[email protected] dev /Users/Dan/Projects/adonuxttest nodemon --watch app --watch bootstrap --watch config --watch .env -x node server.js
[nodemon] 1.11.0
[nodemon] to restart at any time, enter rs
[nodemon] watching: /Users/Dan/Projects/adonuxttest/app//* /Users/Dan/Projects/adonuxttest/bootstrap//* /Users/Dan/Projects/adonuxttest/config/**/* .env
[nodemon] starting node server.js
info adonis:framework +0ms serving app on localhost:3000
TypeError: Nuxt is not a constructor
at new NuxtController (/Users/Dan/Projects/adonuxttest/app/Http/Controllers/NuxtController.js:12:17)
at Object.
Node version - 6.11.0 Adonis version - 2.1.9
Hi,
have the same error.
Node version - 8.1.2 Adonis version - 2.1.8
What Nuxt version?
Hi...
The problem is version 1.0.0-rc3 (package.json "nuxt": "^ 1.0.0-rc3"). With nuxt version 1.0.0-alpha.4 everything ok
.then((nuxt) => { this.nuxt = nuxt if (config.dev) { this.nuxt.build() } }
If you remove those lines from the NuxtController hopefully it should help, I had a similar issue. At least I think what I changed was the right thing to do :)
I started a new project without any changes on Tuesday night and it had a similar issue and found removing those lines to correct the issue.
my nuxt controller looks like
constructor () { let config = Config.get('nuxt') config.dev = Env.get('NODE_ENV') === 'development' this.nuxt = new Nuxt(config) }
- render (request, response) { this.nuxt.render(request.request, response.response) }
If I remove
.then((nuxt) => { this.nuxt = nuxt if (config.dev) { this.nuxt.build() } } then I still get the same error.
If I leave this code removed and then install [email protected], the app builds. I do get another error instead now but it's related to the logo.png file.
` ERROR Failed to compile with 1 errors 10:47:22 AM
error in ./resources/assets/img/logo.png
Module parse failed: /Users/Dan/Projects/adonuxttest/resources/assets/img/logo.png Unexpected character '�' (1:0) You may need an appropriate loader to handle this file type. (Source code omitted for this binary file)
@ ./~/vue-loader/lib/template-compiler?{"id":"data-v-3e04842c","hasScoped":true,"preserveWhitespace":false}!./~/vue-loader/lib/selector.js?type=template&index=0!./resources/layouts/error.vue 6:13-46 @ ./resources/layouts/error.vue @ ./.nuxt/index.js @ ./.nuxt/client.js @ multi webpack-hot-middleware/client?reload=true ./.nuxt/client.js`
Edit: Just realised this error is already reported (#45)
In the config nuxt file just add the loader if it is missing.
build: { loaders: [ { test: /.(png|jpe?g|gif|svg)$/, loader: 'url-loader', query: { limit: 10000, // 10KO name: 'img/[name].[hash].[ext]' } } ] }
Same. Fresh installation.

I have same errors.
Refer to the pull request here https://github.com/nuxt-community/adonuxt-template/pull/59
Hi Thanh,
I can't find your comment in Github. Did you remove it?
On Fri, Aug 4, 2017 at 9:09 AM, Thanh Minh [email protected] wrote:
@wongni https://github.com/wongni Thanks you, but i have new errors:
Error: Cannot find module 'es6-promise\auto' from 'C:\OpenServer\domains\face.io' at Function.module.exports [as sync] (C:\OpenServer\domains\face.io\node_modules\resolve\lib\sync.js:40:15) at r (C:\OpenServer\domains\face.io\node_modules\vue-server-renderer\build.js:7741:44) at Object.
(webpack:/external "es6-promise/auto":1:0) at webpack_require (webpack:/webpack/bootstrap b723638754f17ec59ca0:25:0) at Object. (server-bundle.js:1358:75) at webpack_require (webpack:/webpack/bootstrap b723638754f17ec59ca0:25:0) at Object. (server-bundle.js:996:65) at webpack_require (webpack:/webpack/bootstrap b723638754f17ec59ca0:25:0) at server-bundle.js:92:18 at Object. (server-bundle.js:95:10) at evaluateModule (C:\OpenServer\domains\face.io\node_modules\vue-server-renderer\build.js:7747:21) at C:\OpenServer\domains\face.io\node_modules\vue-server-renderer\build.js:7805:18 at Promise ( ) at C:\OpenServer\domains\face.io\node_modules\vue-server-renderer\build.js:7797:14 at Object.renderToString (C:\OpenServer\domains\face.io\node_modules\vue-server-renderer\build.js:7951:9) at P (C:\OpenServer\domains\face.io\node_modules\nuxt\node_modules\pify\index.js:49:6) — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nuxt-community/adonuxt-template/issues/57#issuecomment-320244602, or mute the thread https://github.com/notifications/unsubscribe-auth/AK_oVXJJzUw0hSsvVhyZzh2H4-9zOvEZks5sUxgfgaJpZM4OnFsA .