Comments (9)
Hundredth start is for me :)
from typeorm.
please install latest version of node
from typeorm.
I upgrade to v7.0.0 but I get a new error :
/node_modules/typeorm/metadata/types/ColumnTypes.js:64
return type.name.toLowerCase();
^TypeError: Cannot read property 'name' of undefined
at Function.typeToString (/home/grevin/nba_prono/node_modules/typeorm/metadata/types/ColumnTypes.js:64:20)
at /home/grevin/nba_prono/node_modules/typeorm/decorator/columns/PrimaryGeneratedColumn.js:13:57
at DecoratePropertyWithoutDescriptor (/home/grevin/nba_prono/node_modules/reflect-metadata/Reflect.js:555:13)
at Object.decorate (/home/grevin/nba_prono/node_modules/reflect-metadata/Reflect.js:108:20)
at __decorate (/home/grevin/nba_prono/models/Match.js:4:92)
at /home/grevin/nba_prono/models/Match.js:12:5
at Object. (/home/grevin/nba_prono/models/Match.js:31:2)
at Module._compile (module.js:573:32)
at Object.Module._extensions..js (module.js:582:10)
at Module.load (module.js:490:32)
The file that seemed to cause an issue :
import {ITeam} from "./Team";
import {Table,Column,PrimaryGeneratedColumn} from "typeorm";
@Table()
export class Match {
@PrimaryGeneratedColumn()
id:number;
@Column()
home: string;
@Column()
away: string;
@Column()
winner: string;
@Column()
date: Date;
}
from typeorm.
can you provide sources for other files too? did you add import "reflect-metadata";
in your app's main file?
from typeorm.
import * as http from "http";
import express = require("express");
import {teamMap} from "./models/Team";
import "reflect-metadata";
import {createConnection} from "typeorm";
import {Match} from "./models/Match";
const hello : string = "Hello";
const app: express.Application = express();
createConnection({
driver: {
type: "sqlite",
database: "nba_prono"
},
entities: [
Match
],
autoSchemaSync: true,
}).then(connection => {
const celtics = teamMap['Celtics'];
const warriors = teamMap['Warriors'];
let match = new Match();
match.away = celtics.name;
match.home = warriors.name;
match.winner = warriors.name;
match.date = new Date();
let matchRepository = connection.getRepository (Match);
matchRepository.persist(match);
// here you can start to work with your entities
});
app.get("/api/v1/teams", (request: express.Request, response: express.Response) => {
response.json(teamMap);
});
app.get("/api/v1/teams/:name",(request:express.Request, response: express.Response)=>{
const name = request.params('name');
response.json(teamMap[name]);
});
console.log(hello);
const server: http.Server = app.listen(3000);
it's the main file.
from typeorm.
You also need to set "emitDecoratorMetadata": true
in your tsconfig.json file
from typeorm.
That's was it. Thank you for your help :)
from typeorm.
don't forget to star the project ;)
from typeorm.
My solution was different. I had to point to the post-transplantation files. See here:
#3629 (comment)
from typeorm.
Related Issues (20)
- QueryFailedError 错误x无法定位源码位置
- The error message of QueryFailedError cannot be located to the source code position. HOT 1
- Relations inside more than one nested embedded with select throws error
- Lazy Relations Not Updating Properly HOT 2
- `stream` is ignoring `take` and `skip` with `join`
- New FindOperator for 'unaccent' command with Postgresql
- Default values in a jsonb column do not generate migrations correctly
- how to make a baseController in typeorm 0.3.17 and extends to other classes like mangoose
- Both CURRENT_TIMESTAMP and CURRENT_TIMESTAMP(0) as default values result in "Invalid default value" error
- Cannot find record in table if it has relation to another table
- Parameter binding fails for Oracle query when parameter name is reused HOT 5
- Predefined table name not being used when using Entity Manager API HOT 1
- Rotate Credentials
- SQL Error from Trailing Line Break in VirtualColumn Query String HOT 2
- Tree Entities can query the tree, but the result is unordered and a sorting parameter should be added
- Add support for ParadeDB Postgres
- The new typeorm version is not compatible with the mongodb driver package version 6.x.x HOT 3
- TreeRepository does not update mpath if parentId was soft-deleted
- Entity instance is not correctly initialized inside .save() method
- Updating a parent of a record with children to a new parent closure table
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 typeorm.