Comments (12)
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.
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.
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.
Good advice, let me try it
from koa-vue-notes-api.
Ok, I tried that, still no joy. Perhaps I can post my configs for you to have a look at?
package.json(.txt):
.babelrc
{ "presets": [ [ "env", { "targets": { "browsers": [ "last 2 versions", "safari >= 7" ] } } ] ] }
npm-packages:
and, last, the output:
from koa-vue-notes-api.
Perhaps I should just put it up in a linux VM ;D
from koa-vue-notes-api.
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.
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:
I have no idea about how to tackle this one :o
from koa-vue-notes-api.
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.
How's it going with this issue?
from koa-vue-notes-api.
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):
-
knex apparently needs to be installed globally in order to be able to run migrations:
$npm install -g knex -
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) -
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.
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)
- ie 11 error HOT 3
- Question HOT 6
- [Q] docker-compose - what are apache & php containers for? HOT 3
- using docker-compose to run the program but can't get access to the localhost:4000 port HOT 1
- Token in User HOT 2
- p2 supports hot reload HOT 2
- Issue Running on Windows 10 HOT 11
- need help HOT 22
- how to add front-end framework in this repo, like vue. Thanks. HOT 2
- windows os 工程跑不起来npm run watch 报错 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from koa-vue-notes-api.