Giter VIP home page Giter VIP logo

Comments (12)

johndatserakis avatar johndatserakis commented on July 29, 2024

No problem. First, I would say to make sure you have the following in your package.json:

"babel": {
    "presets": [
      [
        "env",
        {
          "targets": {
            "browsers": [
              "last 2 versions",
              "safari >= 7"
            ]
          }
        }
      ]
    ]
  },

Perhaps you had deleted that by mistake. If that still doesn't work - then create a .babelrc file in your root directory, delete the above from your package.json, and add this to your newly created .babelrc file:

{
  "presets": [
    [
      "env",
      {
        "targets": {
          "browsers": [
            "last 2 versions",
            "safari >= 7"
          ]
        }
      }
    ]
  ]
}

The reason I'm having you try this is because I figure there may be a chance Windows has an issue reading the babel config from the package.json.

Now, as to why all this is needed - you actually still need babel to use import in node - even in the newer versions. No biggie - just use the babel-preset-env package like I do in this project and it handles it for you. Then, when you build the project and run the project in production with NODE_ENV=production, the app.js file with know to use the files in the generated build folder in the project with the code that's already been transpilled.

from koa-vue-notes-api.

Trellian avatar Trellian commented on July 29, 2024

Thanks for coming back to me!

I hadn't deleted the "babel": section in packages.json, but I tried what you suggested regardless. It's still not working.

I haven't made any other changes since cloning the project. So 'package.json is the original

I also tried an npm update, after these changes, and strangely enough it produced the following, which I wasn't expecting:

+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
added 169 packages, removed 5 packages and updated 46 packages

But still no luck. I will try a few more things and get back to you.

from koa-vue-notes-api.

johndatserakis avatar johndatserakis commented on July 29, 2024

Hmm, at that point I would delete the entire node_modules folder and npm install again just to be safe. Those updates should be fine. I'll be continuing to research as well.

from koa-vue-notes-api.

Trellian avatar Trellian commented on July 29, 2024

Good advice, let me try it

from koa-vue-notes-api.

Trellian avatar Trellian commented on July 29, 2024

@johndatserakis ,

Ok, I tried that, still no joy. Perhaps I can post my configs for you to have a look at?

package.json(.txt):

package.json.txt

.babelrc

{ "presets": [ [ "env", { "targets": { "browsers": [ "last 2 versions", "safari >= 7" ] } } ] ] }

npm-packages:

npm-packages.txt

and, last, the output:

image

from koa-vue-notes-api.

Trellian avatar Trellian commented on July 29, 2024

Perhaps I should just put it up in a linux VM ;D

from koa-vue-notes-api.

johndatserakis avatar johndatserakis commented on July 29, 2024

Hmm, strange. One thing I would do is npm uninstall cross-env - as it could be fighting with the babel-present-env and thus not letting the babel-preset-env do its job.

I will say that I get the same error if I remove the babel-json information from my project - so the issue is definitely due to babel not being able to do its thing properly.

from koa-vue-notes-api.

Trellian avatar Trellian commented on July 29, 2024

Ok, I spun it up in a linux VM, and while that problem has resolved itself... another has surfaced. I'm pretty sure this one isn't your problem, but I'd appreciate it if you could comment. The error as follows:

screenshot from 2017-10-06 12-00-03

I have no idea about how to tackle this one :o

from koa-vue-notes-api.

johndatserakis avatar johndatserakis commented on July 29, 2024

Make sure you have the node version in your vm updated to a latest version. I use nvm in virtual machines if need be.

from koa-vue-notes-api.

johndatserakis avatar johndatserakis commented on July 29, 2024

How's it going with this issue?

from koa-vue-notes-api.

Trellian avatar Trellian commented on July 29, 2024

Hi John, I never got it sorted out under windows, but it's working great in Ubuntu (which is where it's going to live eventually anyway :) ).

A couple of things that you might want to consider adding to the docs/code (for streamlining the setup):

  1. knex apparently needs to be installed globally in order to be able to run migrations:
    $npm install -g knex

  2. The database names in knexfile.js eg (database: process.env.DB_DATABASE + '_testing',
    ) doesn't have the '_dev' suffix for the development db (so it's the same as the production db name)

  3. The users seed doesn't setup the default demousername user

Thanks for an excellent example on Vue + koa + jwt auth !

from koa-vue-notes-api.

johndatserakis avatar johndatserakis commented on July 29, 2024

No problem, thanks for the suggestions. I'll be updating the readme soon. I didn't intend to have the demousername/demopassword in the seeding - but that may help users in the future. And as far as the _dev suffix - that's ok (for me) if they share the same name - as they'll be using totally different connections - but perhaps that could help prevent migrating overwrites done by accident.

Thank you!

from koa-vue-notes-api.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.