Activities

achillesz

achillesz posted a new question

koa-template •

vue init nuxt-community/koa-template nuxt-learn

npm run dev

ERROR Failed to compile with 1 errors 18:43:53

error in ./server/index.js

Module build failed: Error: Plugin/Preset files are not allowed to export objects
, only functions. In /Users/achilles/yilong/nuxt-learn/node_modules/backpack-core
/babel.js

imdunkind

imdunkind posted a new question

koa-template •

Module build failed: Error: Plugin/Preset files are not allowed

`[email protected]:~/NODEJS/testtest$ npm run dev

[email protected] dev /home/imdunkind/NODEJS/testtest
backpack dev

ERROR Failed to compile with 1 errors 11:06:43

error in ./server/index.js

Module build failed: Error: Plugin/Preset files are not allowed to export objects, only functions. In /home/imdunkind/NODEJS/testtest/nodemodules/backpack-core/babel.js at createDescriptor (/home/imdunkind/NODEJS/testtest/nodemodules/@babel/core/lib/config/config-descriptors.js:178:11)
at items.map (/home/imdunkind/NODEJS/testtest/nodemodules/@babel/core/lib/config/config-descriptors.js:109:50) at Array.map (<anonymous>) at createDescriptors (/home/imdunkind/NODEJS/testtest/nodemodules/@babel/core/lib/config/config-descriptors.js:109:29)
at createPresetDescriptors (/home/imdunkind/NODEJS/testtest/nodemodules/@babel/core/lib/config/config-descriptors.js:101:10) at passPerPreset (/home/imdunkind/NODEJS/testtest/nodemodules/@babel/core/lib/config/config-descriptors.js:58:96)
at cachedFunction (/home/imdunkind/NODEJS/testtest/nodemodules/@babel/core/lib/config/caching.js:33:19) at presets.presets (/home/imdunkind/NODEJS/testtest/nodemodules/@babel/core/lib/config/config-descriptors.js:29:84)
at mergeChainOpts (/home/imdunkind/NODEJS/testtest/nodemodules/@babel/core/lib/config/config-chain.js:320:26) at /home/imdunkind/NODEJS/testtest/nodemodules/@babel/core/lib/config/config-chain.js:283:7

internal/modules/cjs/loader.js:605
throw err;
^

Error: Cannot find module '/home/imdunkind/NODEJS/testtest/build/main.js'
at Function.Module.resolveFilename (internal/modules/cjs/loader.js:603:15) at Function.Module.load (internal/modules/cjs/loader.js:529:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:775:12)
at startup (internal/bootstrap/node.js:300:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:826:3)`

package.json
{ "name": "testtest", "version": "1.1.0", "description": "Nuxt.js project", "author": "", "private": true, "scripts": { "dev": "backpack dev", "build": "nuxt build && backpack build", "start": "cross-env NODE_ENV=production node build/main.js", "precommit": "npm run lint", "lint": "eslint --ext .js,.vue --ignore-path .gitignore ." }, "dependencies": { "cross-env": "^5.0.1", "koa": "^2.4.1", "nuxt": "latest", "source-map-support": "^0.4.15" }, "devDependencies": { "babel-eslint": "^7.1.1", "backpack-core": "^0.3.0", "eslint": "^3.13.1", "eslint-loader": "^1.9.0", "eslint-config-standard": "^10.2.1", "eslint-plugin-html": "^2.0.3", "eslint-plugin-import": "^2.2.0", "eslint-plugin-node": "^4.2.2", "eslint-plugin-promise": "^3.4.0", "eslint-plugin-standard": "^3.0.1", "nodemon": "^1.11.0", "scmp": "^2.0.0" } }

freecodemans

freecodemans posted a new question

koa-template •

运行保错

Module build failed (from ./nodemodules/eslint-loader/index.js): TypeError: Cannot read property 'eslint' of undefined at Object.module.exports (E:\vue\nuxt-learn\nodemodules\eslint-loader\index.js:148:18)

You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.

Leesson

Leesson posted a new question

koa-template •

compile error with [email protected]

There is an error when run dev or build:

ERROR in ./.nuxt/client.js
Module build failed (from ./node_modules/eslint-loader/index.js):
TypeError: Cannot read property 'eslint' of undefined
    at Object.module.exports (/Users/didi/Documents/code/test/nuxtKoaTemplate/node_modules/eslint-loader/index.js:148:18)
 @ multi ./.nuxt/client.js app[0]
✖ fatal Nuxt Build Error
Nuxt Fatal Error :(


It is caused by nuxt2.x and can be resolve by updating the dependecies in package.json:

"dependencies": {
   ...
-  "nuxt": "latest",
+  "nuxt": "^1.4.4",
}


Expect to support the latest version

Benleie

Benleie resolved the question #c35

koa-template •

compile error when dev

so i have to use nuxt@1.4.x to fix it

Benleie

Benleie posted a new question

koa-template •

compile error when dev

After installation,when npm run dev
Error: Plugin/Preset files are not allowed to export objects, only functions.
image

And i updated backpack-core to 0.7.0, but this error still exists.

wen-dong

wen-dong posted a new question

koa-template •

error in ./server/index.js

module build failed: Error: Plugin/Preset files are not allowed to export objects, only function.
In node_modules\backpack-core\babel.js

zgunz42

zgunz42 posted a new question

koa-template •

Failed to Start Dev

After first install the template i got this error

CMD:
yarn dev

OUTPUT

 ERROR  Failed to compile with 1 errors                                                                                                                  11:50:11

 error  in ./server/index.js

Module build failed: Error: Plugin/Preset files are not allowed to export objects, only functions. In /home/ubuntu/workspace/node_modules/backpack-core/babel.js
    at createDescriptor (/home/ubuntu/workspace/node_modules/@babel/core/lib/config/config-descriptors.js:178:11)
    at items.map (/home/ubuntu/workspace/node_modules/@babel/core/lib/config/config-descriptors.js:109:50)
    at Array.map (<anonymous>)
    at createDescriptors (/home/ubuntu/workspace/node_modules/@babel/core/lib/config/config-descriptors.js:109:29)
    at createPresetDescriptors (/home/ubuntu/workspace/node_modules/@babel/core/lib/config/config-descriptors.js:101:10)
    at passPerPreset (/home/ubuntu/workspace/node_modules/@babel/core/lib/config/config-descriptors.js:58:96)
    at cachedFunction (/home/ubuntu/workspace/node_modules/@babel/core/lib/config/caching.js:33:19)
    at presets.presets (/home/ubuntu/workspace/node_modules/@babel/core/lib/config/config-descriptors.js:29:84)
    at mergeChainOpts (/home/ubuntu/workspace/node_modules/@babel/core/lib/config/config-chain.js:315:26)
    at /home/ubuntu/workspace/node_modules/@babel/core/lib/config/config-chain.js:278:7

module.js:549
    throw err;
    ^

Error: Cannot find module '/home/ubuntu/workspace/build/main.js'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3
eugeneCN

eugeneCN posted a new question

koa-template •

babel error

`
cd koa-template
npm install
npm run dev

Module build failed: Error: Plugin/Preset files are not allowed to export objects, only functions. In /Users/eMule/Desktop/koa-template/node_modules/backpack-core/babel.js
`

mrxu0

mrxu0 posted a new question

koa-template •

Production caused the file directory to change using require error
import { resolve } from 'path'
const r = path => resolve(__dirname, path)
require(r('./middlewares/general'))

error

/Users/xuyuechao/Work/other-git-project/nuxt-koa/build/main.js:243
        return !(function webpackMissingModule() { var e = new Error("Cannot find module \".\""); e.code = 'MODULE_NOT_FOUND'; throw e; }());
                                                           ^
Error: Cannot find module "."
    at webpackMissingModule (/Users/xuyuechao/Work/other-git-project/nuxt-koa/build/main.js:243:60)
    at /Users/xuyuechao/Work/other-git-project/nuxt-koa/build/main.js:243:18
    at /Users/xuyuechao/Work/other-git-project/nuxt-koa/node_modules/[email protected]@ramda/src/internal/_pipe.js:3:14
    at /Users/xuyuechao/Work/other-git-project/nuxt-koa/node_modules/[email protected]@ramda/src/internal/_pipe.js:3:27
    at /Users/xuyuechao/Work/other-git-project/nuxt-koa/node_modules/[email protected]@ramda/src/internal/_arity.js:5:45
    at _map (/Users/xuyuechao/Work/other-git-project/nuxt-koa/node_modules/[email protected]@ramda/src/internal/_map.js:6:19)
    at map (/Users/xuyuechao/Work/other-git-project/nuxt-koa/node_modules/[email protected]@ramda/src/map.js:57:14)
    at /Users/xuyuechao/Work/other-git-project/nuxt-koa/node_modules/[email protected]@ramda/src/internal/_dispatchable.js:39:15
    at /Users/xuyuechao/Work/other-git-project/nuxt-koa/node_modules/[email protected]@ramda/src/internal/_curry2.js:20:46
    at f1 (/Users/xuyuechao/Work/other-git-project/nuxt-koa/node_modules/[email protected]@ramda/src/internal/_curry1.js:17:17)
    at new Server (/Users/xuyuechao/Work/other-git-project/nuxt-koa/build/main.js:228:5)
    at Object.<anonymous> (/Users/xuyuechao/Work/other-git-project/nuxt-koa/build/main.js:306:11)
    at Object.<anonymous> (/Users/xuyuechao/Work/other-git-project/nuxt-koa/build/main.js:308:30)
    at __webpack_require__ (/Users/xuyuechao/Work/other-git-project/nuxt-koa/build/main.js:22:30)
    at module.exports.module.exports.head.title (/Users/xuyuechao/Work/other-git-project/nuxt-koa/build/main.js:68:18)
    at Object.<anonymous> (/Users/xuyuechao/Work/other-git-project/nuxt-koa/build/main.js:3:10)

How can I avoid this? The solution I came up with is 1. Change the packing method, and the file directory remains unchanged. 2. Be able to modify these imports into a packaged path。 But don't know how to change webpack

Leesson

Leesson posted a new question

koa-template •

how should I open node debug

I want to debug my scripts on port 3000. And I modified the dev script in package.json with this:

"dev": "backpack dev --inspect-brk=3000"

But it show me an error when i run the script:

listen EADDRINUSE 127.0.0.1:3000

How should i open it? thx.

renoirb

renoirb posted a new question

koa-template •

Document how to also make Koa match Nuxt's router.base

Assuming a project needs to have both Nuxt and Koa to answer to non-root routes, it is unclear how we can make Koa also support setting a baseUrl to something else than root / (e.g. /foo/).

Use case

Ability to support running production build to something else than root /.

// nuxt.config.js
module.exports = {
  router: {
    base: '/foo/'
  }
}

As documented in nuxt.js/…/configuration-router

Issue

Koa has no way of knowing the setting change.

TODO

  1. Setup sample repository (see renoirb/experiments-nuxt-koa-env-runtime-201806, branch rework-hare-20180619 as a starting point)
shalldie

shalldie posted a new bug report

koa-template •

bug compile error when titleTemplate is a function

Version

vue-cli

Reproduction link

https://github.com/shalldie/nuxt-koa-tpl-err

Steps to reproduce

  1. npm install

  2. npm run dev

What is expected ?

compile successfully and the title is ok.

What is actually happening?

compile error when titleTemplagte is a function

Additional comments?

after vue init nuxt-community/koa-template demo and npm intall

in nuxt.config.js, i add this:

  head: {
    title: '',
    titleTemplate: titleChunk => {
      // If undefined or blank then we don't need the hyphen
      return titleChunk ? `${titleChunk} - wqnmlgbd >_<#@!` : 'wqnmlgbd >_<#@!';
    },
  ...

when i try npm run dev, an error appears:

err.png

shalldie

shalldie posted a new question

koa-template •

compile error when titleTemplagte is a function

vue-cli version: 2.9.6

command: vue init nuxt-community/koa-template demo

in nuxt.config.js, i add this:

  head: {
    title: '',
    titleTemplate: titleChunk => {
      // If undefined or blank then we don't need the hyphen
      return titleChunk ? `${titleChunk} - wqnmlgbd >_<#@!` : 'wqnmlgbd >_<#@!';
    },
  ...

when i try npm run dev, an error appears:

image

bihaiyouhong12

bihaiyouhong12 posted a new question

koa-template •

"titleTemplate" cannot be set to a function

When I set the "head.titleTemplate" in "nuxt.config.js" to a function, and run the command "npm run dev", It throws an error:
image

alanisme

alanisme posted a new question

koa-template •

Why middleware return 'Promise' in `./server/index.js`? Where does 'resolve' and 'reject' come from?

app.use(async (ctx, next) => { await next() ctx.status = 200 // koa defaults to 404 when it sees that status is unset return new Promise((resolve, reject) => { ctx.res.on('close', resolve) ctx.res.on('finish', resolve) nuxt.render(ctx.req, ctx.res, promise => { // nuxt.render passes a rejected promise into callback on error. promise.then(resolve).catch(reject) }) }) })

wscj

wscj posted a new question

koa-template •

No parser and no filepath given

My node.js version is v8.9.4
when I run npm run dev, the console warned:
No parser and no filepath given, using 'babylon' the parser now but this will throw an error in the future. Please specify a parser or a filepath so one can be inferred.

Just a warning, ignore it ?

moedong

moedong posted a new question

koa-template •

SyntaxError: Unexpected token ...

When I enter “run npm dev”,Console display:

DONE Compiled successfully in 655ms 11:59:05

E:\node\koa-nuxt\node[email protected]@nuxt\lib\core\middleware\nuxt.js:72 const policies = this.options.render.csp.policies ? {…this.options.rende r.csp.policies} : null ^^^ SyntaxError: Unexpected token … 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) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module.load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (E:\node\koa-nuxt\[email protected]@nuxt\lib\co
re\renderer.js:19:24)

yoyoys

yoyoys posted a new question

koa-template •

regeneratorRuntime is not defined

Node version: v9.5.0
Vue Cli: 2.9.3

I've just init this template by follow these steps: (alse tried by yarn)
vue init nuxt-community/koa-template nuxt-koa-test
npm install
npm run dev

and i got errors like this

 ERROR  Failed to compile with 1 errors                                                                                     

 error  in ./server/index.js

Module build failed: Error: Couldn't find preset "env" relative to directory
.....
/Users/Yoyo/github/nuxt-koa-test/build/main.js:216
}();
 ^
ReferenceError: regeneratorRuntime is not defined
    at /Users/Yoyo/github/nuxt-koa-test/build/main.js:135:46

And i tried to add a .babelrc file, like this:

{
  "presets": ["env"]
}

Then the first error message gone, but the second error still.
Is that a polyfill problem?

Thanks for help!

rlataguerra

rlataguerra posted a new question

koa-template •

No Generate commande

the readme inside the template talks about a npm run generate command while there is none in package.json

https://github.com/nuxt-community/koa-template/blob/master/template/README.md
https://github.com/nuxt-community/koa-template/blob/master/template/package.json