nuxt-community / express-template Goto Github PK
View Code? Open in Web Editor NEWStarter template for Nuxt 2 with Express.
Home Page: https://codesandbox.io/s/github/nuxt-community/express-template
Starter template for Nuxt 2 with Express.
Home Page: https://codesandbox.io/s/github/nuxt-community/express-template
I'm trying to debug this with Visual Studio Code. I have breakpoints set in the get methods in users.js, but none of the breakpoints are being hit. My launch.json looks like this:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceRoot}\\build\\main.js"
}
]
}
this solution will run out of asar?
https://github.com/electron/asar
of electron.io
https://github.com/electron/electron
Before adding backpack
this template worked ok with Vuetify. But now it crash when it tries to load *.styl
files. When I run npm run dev
throws this is the error:
* !!vue-style-loader!css-loader!../node_modules/vue-loader/lib/style-compiler/index?{"id":"data-v-216ea150","scoped":false,"hasInlineConfig":true}!stylus-loader!css/app.styl in ./.nuxt/App.vue
To install it, you can run: npm install --save !!vue-style-loader!css-loader!../node_modules/vue-loader/lib/style-compiler/index?{"id":"data-v-216ea150","scoped":false,"hasInlineConfig":true}!stylus-loader!css/app.styl
This is part of my nuxt.config.js
that worked previously:
//...
plugins: ['~plugins/vuetify.js'],
css: [
{src: join(__dirname, 'css/app.styl'), lang: 'styl'}
],
build: {
vendor: ['vuetify', 'axios'],
//....
I'm not sure how to fix it. Does backpack
need the vue-loader
config? Which part of the config should be updated?
I cannot understand why 'req.url' always has buggy behavior.
I just initialized new project with vue init nuxt/express . && yarn
Then i've removed server/api/users.js
and remove including require('users')
from server/api/index.js
No references to users
, right?
But,
http://127.0.0.1:3000/foo
it shows in terminal /users/foo
http://127.0.0.1:3000/api/foo
it shows in terminal /foo
http://127.0.0.1:3000/foo/bar
it shows in terminal nothing, but redirects to 404
Cannot understand 1
and 2
behavior
Looks like a bug
Do i need to run through babel? I'm using node v7.x.
npm run dev
> [email protected] dev /home/uptown/Projects/Opensource/nuxt-express
> nodemon --exec babel-node -w server.js -w nuxt.config.js -w api/ server.js
[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: server.js nuxt.config.js /home/uptown/Projects/Opensource/nuxt-express/api/**/*
[nodemon] starting `babel-node server.js`
/home/uptown/Projects/Opensource/nuxt-express/node_modules/vue-ssr-html-stream/index.js:4
class HTMLStream extends Transform {
^^^^^
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Module._extensions..js (module.js:416:10)
at Object.require.extensions.(anonymous function) [as .js] (/home/uptown/Projects/Opensource/nuxt-express/node_modules/babel-register/lib/node.js:152:7)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/uptown/Projects/Opensource/nuxt-express/node_modules/vue-server-renderer/build.js:6764:18)
at Module._compile (module.js:409:26)
[nodemon] app crashed - waiting for file changes before starting...
I think I created an issue ticket on the wrong project before (nuxt-community/koa-template#8), made sure to try this template with a clean cli install, but it didn't help. Tried logging the config in app.js but dev is always false, something missing or is it me this time too? ๐
Hi guys
I have a function that I can it run Nuxt in Sails.JS (with Express). My ask is, how to integrate ESlint (for nuxt - vue ) in this point?
customMiddleware: function (app) {
const Nuxt = require('nuxt')
let config = require('../nuxt.config.js')
const nuxt = new Nuxt(config)
config.dev = !(process.env.NODE_ENV === 'production')
app.use(nuxt.render)
if (config.dev) {
nuxt.build()
.catch((error) => {
console.error(error)
process.exit(1)
})
}
}
Thanks
Hello,
I have this error just create project:
(node:180) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: app.use() requires middleware functions
Steps:
NODE_ENV variable is undefined.
Nuxt is installed globally.
The machine is Windows 10.
I try with node 6.9.5 and 8.0.0 and get same error.
import Nuxt from 'nuxt'
import express from 'express'
const app = express()
const host = process.env.HOST || '127.0.0.1'
const port = process.env.PORT || 3000
app.set('port', port)
// Start nuxt.js
async function start() {
// Import and Set Nuxt.js options
let config = require('../nuxt.config.js')
config.dev = !(process.env.NODE_ENV === 'production')
// Instanciate nuxt.js
const nuxt = new Nuxt(config)
// Add nuxt.js middleware
app.use(nuxt.render) # !!!!! error here (seems like) !!!!!!!
// Listen the server
app.listen(port, host)
console.log('Server listening on ' + host + ':' + port) // eslint-disable-line no-console
}
start()
full error on yarn run dev
DONE Compiled successfully in 65ms 9:44:32 PM
(node:11837) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: app.use() requires middleware functions
I build a login with github?
Code:
index.js
`import Nuxt from 'nuxt'
import express from 'express'
var session = require('express-session');
var passport = require('passport');
var GitHubStrategy = require('passport-github2').Strategy;
require('dotenv').config()
var GITHUB_CLIENT_ID = "d31b61d6f66614bae0cf";
var GITHUB_CLIENT_SECRET = "7fbd3cd8ee9b9f367d05488c8d83838b675a7532";
import api from './api'
const app = express()
const host = process.env.HOST || '127.0.0.1'
const port = process.env.PORT || 3000
passport.serializeUser(function(user, done) {
done(null, user);
});
passport.deserializeUser(function(obj, done) {
done(null, obj);
});
app.set('port', port)
// Import API Routes
app.use('/api', api)
passport.use(new GitHubStrategy({
clientID: GITHUB_CLIENT_ID,
clientSecret: GITHUB_CLIENT_SECRET,
callbackURL: "http://localhost:8080/api/auth/github/callback"
},
function(accessToken, refreshToken, profile, done) {
// asynchronous verification, for effect...
process.nextTick(function () {
return done(null, profile);
});
}
));
app.use(session({ secret: 'keyboard cat', resave: true, saveUninitialized: true }));
app.use(passport.initialize())
app.use(passport.session())
// Start nuxt.js
async function start() {
// Import and Set Nuxt.js options
let config = require('../nuxt.config.js')
config.dev = !(process.env.NODE_ENV === 'production')
// Instanciate nuxt.js
const nuxt = new Nuxt(config)
// Add nuxt.js middleware
app.use(nuxt.render)
// Listen the server
app.listen(port, host)
console.log('Server listening on ' + host + ':' + port) // eslint-disable-line no-console
}
start()
`
auth.js
`import { Router } from 'express'
var passport = require('passport');
var router = Router()
router.get('/auth/github', passport.authenticate('github', { scope: [ 'user:email' ] }));
router.get('/auth/github/callback', passport.authenticate('github', { failureRedirect: '/' }),
function(req, res) {
// Successful authentication, redirect home.
res.redirect('/');
});
export default router
`
but router.get('/auth/github/callback' not working. please help me!!!!
just like this
async asyncData (ctx) {
// expect an express req object(https://expressjs.com/en/4x/api.html#req)
// not NodeAPI incomeMessage (https://nodejs.org/api/http.html#http_class_http_incomingmessage)
console.log(ctx.req)
}
any suggestion?
I have Node v8.1.2, after running npm run dev
Error:
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: app.use() requires middleware functions
The problem is here: app.use(nuxt.render)
With Node 7.* is working properly.
Hi After installing Nuxt + Express template and then run npm run dev
, following is what I am getting.
(node:11558) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: app.use() requires middleware functions
I am wondering whether there is a way to get the host of the application with this setup. I think that in NuxtJS standalone you can call this.origin
although I'm not sure now whether it returned the hostname when rendered client-side or server-side.
I tried looking at the baseURI of an element, but of course when rendered from the server, this isn't available.
Basically I'm just trying to create a simple function to determine a path to an API depending on if I'm in development or production. This is my mixin:
let mixins = {
methods: {
apiUrl: function (src) {
let baseURI = 'http://example.com'
return (process.env.NODE_ENV !== 'production' ? (baseURI + ':9000') : baseURI.replace('//', '//api.')) + '/' + src
}
}
}
exports.mixin = mixins
So basically in development it'd output http://developmentdomain.com:9000/path/to/call
and production would be https://api.productiondomain.com/path/to/call
I know the NODE_ENV is not available in development, but that's OK because it is in production so that bit works. But if I use HOST then it works on server-side calls, and this['$el'].baseURI would work on client-side but it seems a bit hacky and I'm hoping there's something simple I'm missing because I'm new to this.
Thanks in advance for any advice.
The command NODE_ENV=production node server.js
will through an error in windows. I changed it to set NODE_ENV=production&& node server.js
and things seem to work fine.
Note: Not having a whitespace after the word production is required to make this work.
I believe this command should also work under linux environments, but I can't test this.
Can we do something so that this works on windows by default?
D:\Personal\Desktop\gaga-old>npm install backpack-core -g
npm ERR! Unexpected end of input at 1:19311
npm ERR! s":{"babel-runtime":"^5.0.0"},"devDependencies":{"babel-helper-fixtur
npm ERR! ^
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\340089\AppData\Roaming\npm-cache\_logs\2017-06-16T02_33_02_295Z-debug.log
This is after a fresh install:
~/Desktop/webProjects/nuxt $ npm run dev
> [email protected] dev /home/user/Desktop/webProjects/nuxt
> nodemon --exec babel-node -w server.js -w nuxt.config.js -w api/ server.js
[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: server.js nuxt.config.js /home/user/Desktop/webProjects/nuxt/api/**/*
[nodemon] starting `babel-node server.js`
Server listening on 127.0.0.1:3000
build [= ] 10%(node:10697) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see https://github.com/webpack/loader-utils/issues/56
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
Build completed in 2.438s
webpack built b17535a681f8d6c520b0 in 2439ms
webpack building...
Build completed in 0.139s
webpack built b17535a681f8d6c520b0 in 140ms
webpack building...
Build completed in 0.111s
webpack built b17535a681f8d6c520b0 in 111ms
webpack building...
Build completed in 0.098s
webpack built b17535a681f8d6c520b0 in 99ms
webpack building...
Build completed in 0.142s
webpack built b17535a681f8d6c520b0 in 143ms
webpack building...
Build completed in 0.158s
webpack built b17535a681f8d6c520b0 in 159ms
webpack building...
Build completed in 0.11s
webpack built b17535a681f8d6c520b0 in 109ms
webpack building...
Build completed in 0.099s
webpack built b17535a681f8d6c520b0 in 99ms
webpack building...
Build completed in 0.1s
webpack built b17535a681f8d6c520b0 in 100ms
webpack building...
Build completed in 0.103s
webpack built b17535a681f8d6c520b0 in 104ms
webpack building...
Build completed in 0.105s
webpack built b17535a681f8d6c520b0 in 105ms
webpack building...
Build completed in 0.099s
webpack built b17535a681f8d6c520b0 in 98ms
webpack building...
Build completed in 0.089s
webpack built b17535a681f8d6c520b0 in 89ms
webpack building...
Build completed in 0.091s
webpack built b17535a681f8d6c520b0 in 91ms
webpack building...
Build completed in 0.116s
webpack built b17535a681f8d6c520b0 in 116ms
webpack building...
Build completed in 0.106s
webpack built b17535a681f8d6c520b0 in 105ms
webpack building...
Build completed in 0.112s
webpack built b17535a681f8d6c520b0 in 113ms
webpack building...
Build completed in 0.089s
webpack built b17535a681f8d6c520b0 in 89ms
webpack building...
Build completed in 0.098s
webpack built b17535a681f8d6c520b0 in 98ms
webpack building...
Build completed in 0.088s
webpack built b17535a681f8d6c520b0 in 88ms
webpack building...
Build completed in 0.133s
webpack built b17535a681f8d6c520b0 in 133ms
webpack building...
Build completed in 0.144s
webpack built b17535a681f8d6c520b0 in 144ms
webpack building...
Build completed in 0.109s
webpack built b17535a681f8d6c520b0 in 109ms
webpack building...
Build completed in 0.093s
webpack built b17535a681f8d6c520b0 in 93ms
webpack building...
Build completed in 0.046s
webpack built b17535a681f8d6c520b0 in 46ms
I've done this in other node projects before. New to Nuxt but thought it'd be similar.
import Nuxt from 'nuxt'
import express from 'express'
import api from './api'
const app = express();
const host = process.env.HOST || 'localhost';
const port = process.env.PORT || 3000;
const https = require("https");
const fs = require("fs");
const serverConfig = require('./config.json')[process.env.NODE_ENV || 'development'];
const pkey = fs.readFileSync(serverConfig.HTTPS_KEY);
const pcert = fs.readFileSync(serverConfig.HTTPS_CERT);
const httpsOptions = {
key: pkey,
cert: pcert
};
app.set('port', port);
// Import API Routes
app.use('/api/v1', api);
// Start nuxt.js
async function start() {
// Import and Set Nuxt.js options
let config = require('../nuxt.config.js')
config.dev = !(process.env.NODE_ENV === 'production')
// Instanciate nuxt.js
const nuxt = new Nuxt(config)
// Add nuxt.js middleware
app.use(nuxt.render)
// Listen the server
https.createServer(httpsOptions, app).listen(port, host);
console.log('Server listening on ' + host + ':' + port) // eslint-disable-line no-console
}
start()
When I run this the /api/v1/users endpoint and all other API endpoints work, but when I go to https://localhost:3000 it gives me:
Error: socket hang up
at createHangUpError (_http_client.js:302:15)
at Socket.socketOnEnd (_http_client.js:394:23)
at emitNone (events.js:91:20)
at Socket.emit (events.js:188:7)
at endReadableNT (_stream_readable.js:975:12)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
Been digging around for a couple of days but no luck. Anyone have a clue to get me started down the right path?
After updating nuxt
, such an error
Rollback to previous versions of the results did not give
When commenting line app.use(nuxt.render)
, the error disappears, and as a result, there is no rendering
The conclusion that the error is explicitly missing in my code
What do I need to do to fix it?
Hi, I am not sure if this is a issue, but when I try to run npm run dev
, there is seems like a bundle of loop webpack building instead of only one time building. (See the gif image below)
Why it takes too many building step? Please help, thank you guys!
Windows 10
# node -v
v7.3.0
# yarn version
yarn version v0.20.3
# npm -v
3.10.10
# vue -V
2.8.1
After deploying template with Zeit's now
(empty project generated with vue init nuxt-community/express
) I can access /api
route but the site itself returns ERR_SPDY_PROTOCOL_ERROR
This works: https://test-vvyxsxcicp.now.sh/api/users
This doesn't: https://test-vvyxsxcicp.now.sh/
Might be related to #60
So I cloned this template (didn't change any code) and deployed via now
to here --> https://nuxt-express-dmdndmadiv.now.sh.
This could just be my misunderstanding of how express
/ nuxt
work together, but the <nuxt-link>
s never work as it looks to be trying to load the /api
route(s) via localhost:3000.
But, a full page refresh on user 0 https://nuxt-express-dmdndmadiv.now.sh/0 works just fine.
Could this be an axios
issue too?
I'm trying to integrate ElementUI with Nuxt and I found a weird problem related with components who use i18n terms (locale strings).
First I thought was something related with Nuxt itself but I ran the same test based on starter template and worked as expected.
Here my plugins/element-ui.js
file:
import Vue from 'vue';
const ElementUI = require('element-ui');
const locale = require('element-ui/lib/locale/lang/pt-br');
Vue.use(ElementUI, { locale });
When I add the datepicker component using starter template I got this:
(everything works as expected)
As you can see, all strings are loaded in Brazilian Portuguese: Month name, week days, today (hoje)
But if I try to use the same template on Express template I got this:
AS you can see all strings disappeared.
In both examples I used this snippet here
<template>
...
<div id="app">
<el-form ref="form" :model="form" label-width="120px">
<el-form-item label="Activity name">
<el-input v-model="form.name"></el-input>
</el-form-item>
<el-form-item label="Activity time">
<el-col :span="11">
<el-date-picker type="date" placeholder="Pick a date" v-model="form.date1" style="width: 100%;"></el-date-picker>
</el-col>
<el-col class="line" :span="2">-</el-col>
<el-col :span="11">
<el-time-picker type="fixed-time" placeholder="Pick a time" v-model="form.date2" style="width: 100%;"></el-time-picker>
</el-col>
</el-form-item>
<el-form-item label="Instant delivery">
<el-switch on-text="" off-text v-model="form.delivery"></el-switch>
</el-form-item>
<el-form-item label="Activity type">
<el-checkbox-group v-model="form.type">
<el-checkbox label="Online activities" name="type"></el-checkbox>
<el-checkbox label="Promotion activities" name="type"></el-checkbox>
<el-checkbox label="Offline activities" name="type"></el-checkbox>
<el-checkbox label="Simple brand exposure" name="type"></el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="Resources">
<el-radio-group v-model="form.resource">
<el-radio label="Sponsor"></el-radio>
<el-radio label="Venue"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="Activity form">
<el-input type="textarea" v-model="form.desc"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">Create</el-button>
<el-button>Cancel</el-button>
</el-form-item>
</el-form>
</div>
</section>
</template>
<script>
export default {
head() {
return {
title: 'Index',
};
},
data() {
return {
form: {
name: '',
region: '',
date1: '',
date2: '',
delivery: false,
type: [],
resource: '',
desc: '',
},
};
},
methods: {
onSubmit() {
console.log('submit!');
},
},
};
</script>
In both environments I'm using the latest ElementUI version. Anybody have the same issue? Is something I'm doing wrong?
PS: Doesn't matter if I'm requesting the datepicker from the server (hard reload) or via client (navigating between links)
Thanks in advance,
Hello!
I know that it's not the best idea to work on Windows but I have problem:
This dependency was not found:
* plugins/axios in ./plugins/axios.js
To install it, you can run: npm install --save plugins/axios
This relative module was not found:
* ./plugins/axios in ./~/babel-loader/lib?{"presets":["vue-app"],"babelrc":false,"cacheDirectory":true}!./~/vue-loader/lib/selector.js?type=script&index=0!./pages/_id.vue
there is a list of errors
I can understand where to look for a mistake?
you can add more debug information?
logs from pm2
TypeError: Cannot read property 'join' of undefined
at _callee$ (__vue_ssr_bundle__:8511:60)
at tryCatch (__vue_ssr_bundle__:10094:40)
at Generator.invoke [as _invoke] (__vue_ssr_bundle__:10329:22)
at step (__vue_ssr_bundle__:272:30)
at __vue_ssr_bundle__:283:13
at process._tickDomainCallback [as _tickCallback] (internal/process/next_tick.js:129:7)
You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection:
TypeError: Cannot read property 'join' of undefined
at _callee$ (__vue_ssr_bundle__:8511:60)
at tryCatch (__vue_ssr_bundle__:10094:40)
at Generator.invoke [as _invoke] (__vue_ssr_bundle__:10329:22)
at step (__vue_ssr_bundle__:272:30)
at __vue_ssr_bundle__:283:13
at process._tickDomainCallback [as _tickCallback] (internal/process/next_tick.js:129:7)
You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection:
TypeError: Cannot read property 'join' of undefined
at _callee$ (__vue_ssr_bundle__:8511:60)
at tryCatch (__vue_ssr_bundle__:10094:40)
at Generator.invoke [as _invoke] (__vue_ssr_bundle__:10329:22)
at step (__vue_ssr_bundle__:272:30)
at __vue_ssr_bundle__:283:13
at process._tickDomainCallback [as _tickCallback] (internal/process/next_tick.js:129:7)
You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection:
TypeError: Cannot read property 'join' of undefined
at _callee$ (__vue_ssr_bundle__:8511:60)
at tryCatch (__vue_ssr_bundle__:10094:40)
at Generator.invoke [as _invoke] (__vue_ssr_bundle__:10329:22)
at step (__vue_ssr_bundle__:272:30)
at __vue_ssr_bundle__:283:13
at process._tickDomainCallback [as _tickCallback] (internal/process/next_tick.js:129:7)
You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection:
TypeError: Cannot read property 'join' of undefined
at _callee$ (__vue_ssr_bundle__:8511:60)
at tryCatch (__vue_ssr_bundle__:10094:40)
at Generator.invoke [as _invoke] (__vue_ssr_bundle__:10329:22)
at step (__vue_ssr_bundle__:272:30)
at __vue_ssr_bundle__:283:13
at process._tickDomainCallback [as _tickCallback] (internal/process/next_tick.js:129:7)
You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection:
Error: Request failed with status code 404
at createError (/node_www/video-public.ru_express/node_modules/axios/lib/core/createError.js:15:15)
at settle (/node_www/video-public.ru_express/node_modules/axios/lib/core/settle.js:18:12)
at IncomingMessage.handleStreamEnd (/node_www/video-public.ru_express/node_modules/axios/lib/adapters/http.js:186:11)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:186:7)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickDomainCallback [as _tickCallback] (internal/process/next_tick.js:122:9)
Channel is already closed can't broadcast error:
TypeError: Converting circular structure to JSON
at JSON.stringify (<anonymous>)
at process.target._send (internal/child_process.js:639:23)
at process.send (/usr/lib/node_modules/pm2/lib/ProcessContainer.js:54:42)
at process.uncaughtListener (/usr/lib/node_modules/pm2/lib/ProcessContainer.js:276:19)
at emitTwo (events.js:106:13)
at process.emit (events.js:192:7)
at emitPendingUnhandledRejections (internal/process/promises.js:85:22)
at process._tickDomainCallback [as _tickCallback] (internal/process/next_tick.js:130:7)
> backpack dev
(node:14724) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see https://github.com/webpack/loader-utils/issues/56
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
DONE Compiled successfully in 1633ms 12:48:45 AM
module.js:472
throw err;
^
Error: Cannot find module 'F:\OP\My blog\"F:\OP'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:423:7)
at startup (bootstrap_node.js:147:9)
at bootstrap_node.js:538:3
getting these errors when trying to run npm run dev
In order to use Heroku's Nodejs build pack, I've created a postinstall
script in package.json
that runs yarn build
.
This will failure though because the build relies on a few babel
packages which are currently listed as dev dependencies.
Heroku does not install dev dependencies by default.
This should be able to be fixed locally either through Heroku configuration or by moving the dependencies locally outside of dev
.
I'm filing this issue because it seems that it may be incorrect that these are listed as devDependencies
. All other dependencies that are required for the build (including those from Nuxt) are listed as dependencies
and work by default with the build packs decision to not install dev dependencies.
Should dev dependencies only be for packages that are used exclusively in development commands such as nuxt dev
?
Hi @pi0 , I recently upgraded Nuxt.js to latest release which is rc2
. For some reason, the run dev
and build
is failing with this template ? I was hoping if there's a quick solution to resolve problem apart from downgrading the nuxt
version ?
Error:
(node:4906) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: __WEBPACK_IMPORTED_MODULE_2_nuxt___default.a is not a constructor
Is possible to use import/export
features in the routes? I changed server.js
to start like this:
import Nuxt from 'nuxt'
import express from 'express'
import api from './api'
....
And api/index.js
to this:
import { Router } from 'express'
import users from './users'
const router = Router()
// Add USERS Routes
router.use(users)
export default router
It works during npm run dev
, but not after npm run build
and npm start
, I'm getting this error:
function (exports, require, module, __filename, __dirname) { import Nuxt from 'nuxt';
^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:53:10)
at Object.runInThisContext (vm.js:95:10)
at Module._compile (module.js:543:28)
at Object.Module._extensions..js (module.js:580:10)
...
What should I change to enable this?
Thanks.
Hi,
When I try to add the following into my nuxt.config.js file:
router: { scrollBehavior: function (to, from, savedPosition) { return { x: 0, y: 0 } } }
I get the following error output in the console/terminal:
` error in ./.nuxt/router.js
Syntax Error: Unexpected token, expected ( (29:32)
27 |
28 |
29 | const scrollBehavior = function function(to, from, savedPosition) {
| ^
30 | return { x: 0, y: 0 };
31 | }
32 |
@ ./.nuxt/index.js 119:0-43
@ ./.nuxt/client.js
@ multi webpack-hot-middleware/client?reload=true ./.nuxt/client.js`
I am using nuxt version 1.0.0-alpha.4 and the latest version of express-template.
I have also tried adding the scrollToTop: true
option into my .vue files but that doesn't seem to work either.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.