Set up problem #1

Closed
opened 2025-04-18 13:07:49 +02:00 by alanthird · 4 comments

Hi, I don't know much about Node so apologies if this is really obvious.

I'm trying to set up GPSTracker without using Docker and when i run "npm run start" it's throwing up an error. I'm using sqlite as a DB and the installation appears to have had no errors up to this point.

bash-5.2$ npm run start

> server@1.0.0 start
> node dist/main.js

⌛ Syncing database
Server is running on port 127.0.0.1:3000
{ event: 'migrating', name: '000_initial.js' }
{ event: 'migrated', name: '000_initial.js', durationSeconds: 0.572 }
{ event: 'migrating', name: '001_add_metadata_to_location_points.js' }
{
  event: 'migrated',
  name: '001_add_metadata_to_location_points.js',
  durationSeconds: 0.277
}
{ event: 'migrating', name: '000_initial.ts' }
/opt/gpstracker/node_modules/umzug/lib/umzug.js:170
                    throw new MigrationError({ direction: 'up', ...params }, e);
                          ^

MigrationError: Migration 000_initial.ts (up) failed: Original error: Unexpected token ':'

TypeScript files can be required by adding `ts-node` as a dependency and calling `require('ts-node/register')` at the program entrypoint before running migrations.
    at /opt/gpstracker/node_modules/umzug/lib/umzug.js:170:27
    at async Umzug.runCommand (/opt/gpstracker/node_modules/umzug/lib/umzug.js:126:20)
    at async Migrations.up (/opt/gpstracker/dist/db/Migrations.js:16:9)
    at async Db.sync (/opt/gpstracker/dist/db/Db.js:93:9) {
  cause: /opt/gpstracker/src/db/migrations/000_initial.ts:4
  async function createUsersTable(query: { context: any }) {
                                       ^
  
  SyntaxError: Unexpected token ':'
      at wrapSafe (node:internal/modules/cjs/loader:1281:20)
      at Module._compile (node:internal/modules/cjs/loader:1321:27)
      at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
      at Module.load (node:internal/modules/cjs/loader:1208:32)
      at Module._load (node:internal/modules/cjs/loader:1024:12)
      at Module.require (node:internal/modules/cjs/loader:1233:19)
      at require (node:internal/modules/helpers:179:18)
      at loadModule (/opt/gpstracker/node_modules/umzug/lib/umzug.js:391:34)
      at getModule (/opt/gpstracker/node_modules/umzug/lib/umzug.js:380:26)
      at Object.up (/opt/gpstracker/node_modules/umzug/lib/umzug.js:405:43),
  jse_cause: /opt/gpstracker/src/db/migrations/000_initial.ts:4
  async function createUsersTable(query: { context: any }) {
                                       ^
  
  SyntaxError: Unexpected token ':'
      at wrapSafe (node:internal/modules/cjs/loader:1281:20)
      at Module._compile (node:internal/modules/cjs/loader:1321:27)
      at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
      at Module.load (node:internal/modules/cjs/loader:1208:32)
      at Module._load (node:internal/modules/cjs/loader:1024:12)
      at Module.require (node:internal/modules/cjs/loader:1233:19)
      at require (node:internal/modules/helpers:179:18)
      at loadModule (/opt/gpstracker/node_modules/umzug/lib/umzug.js:391:34)
      at getModule (/opt/gpstracker/node_modules/umzug/lib/umzug.js:380:26)
      at Object.up (/opt/gpstracker/node_modules/umzug/lib/umzug.js:405:43),
  migration: {
    direction: 'up',
    name: '000_initial.ts',
    path: '/opt/gpstracker/src/db/migrations/000_initial.ts',
    context: <ref *3> SQLiteQueryInterface {
      sequelize: <ref *1> Sequelize {
        options: {
          dialect: 'sqlite',
          dialectModule: null,
          dialectModulePath: null,
          host: '',
          protocol: 'tcp',
          define: {},
          query: {},
          sync: {},
          timezone: '+00:00',
          standardConformingStrings: true,
          logging: false,
          omitNull: false,
          native: false,
          replication: false,
          ssl: undefined,
          pool: {},
          quoteIdentifiers: true,
          hooks: {},
          retry: { max: 5, match: [Array] },
          transactionType: 'DEFERRED',
          isolationLevel: null,
          databaseVersion: 0,
          typeValidation: false,
          benchmark: false,
          minifyAliases: false,
          logQueryParameters: false,
          attributeBehavior: 'throw',
          storage: '/var/opt/gpstracker/app.db',
          dialectOptions: [Object: null prototype] {}
        },
        config: {
          database: 'var/opt/gpstracker/app.db',
          username: undefined,
          password: null,
          host: '',
          port: undefined,
          pool: {},
          protocol: 'tcp',
          native: false,
          ssl: undefined,
          replication: false,
          dialectModule: null,
          dialectModulePath: null,
          keepDefaultTimezone: undefined,
          dialectOptions: [Object: null prototype] {}
        },
        dialect: <ref *2> SqliteDialect {
          sequelize: [Circular *1],
          connectionManager: ConnectionManager {
            sequelize: [Circular *1],
            config: [Object],
            dialect: [Circular *2],
            versionPromise: null,
            dialectName: 'sqlite',
            pool: [Pool],
            connections: [Object],
            lib: [Object]
          },
          queryGenerator: SQLiteQueryGenerator {
            sequelize: [Circular *1],
            options: [Object],
            dialect: 'sqlite',
            _dialect: [Circular *2],
            _quoteIdentifier: [Function: quoteIdentifier],
            quoteIdentifier: [Function (anonymous)],
            OperatorMap: [Object],
            typeValidation: undefined
          },
          queryInterface: [Circular *3]
        },
        queryInterface: [Circular *3],
        models: {
          SequelizeMeta: [class SequelizeMeta extends Model] {
            sequelize: [Circular *1],
            options: [Object],
            associations: {},
            underscored: false,
            tableName: 'SequelizeMeta',
            _schema: null,
            _schemaDelimiter: '',
            rawAttributes: [Object],
            _indexes: [],
            primaryKeys: [Object],
            _readOnlyAttributes: Set(0) {},
            _timestampAttributes: {},
            _hasReadOnlyAttributes: false,
            _dataTypeChanges: {},
            _dataTypeSanitizers: {},
            _hasBooleanAttributes: false,
            _hasDateAttributes: false,
            _jsonAttributes: Set(0) {},
            _virtualAttributes: Set(0) {},
            _defaultValues: {},
            fieldRawAttributesMap: [Object],
            uniqueKeys: [Object],
            fieldAttributeMap: {},
            _hasJsonAttributes: false,
            _hasVirtualAttributes: false,
            _hasDefaultValues: false,
            tableAttributes: [Object],
            primaryKeyAttributes: [Array],
            primaryKeyAttribute: 'name',
            primaryKeyField: 'name',
            _hasPrimaryKeys: true,
            _isPrimaryKey: [Function (anonymous)],
            _attributeManipulation: [Object],
            autoIncrementAttribute: null,
            _scope: {},
            _scopeNames: [Array],
            _overwrittenAttributesChecked: true
          }
        },
        modelManager: ModelManager {
          models: [ [Function] ],
          sequelize: [Circular *1]
        },
        connectionManager: <ref *4> ConnectionManager {
          sequelize: [Circular *1],
          config: {
            database: 'var/opt/gpstracker/app.db',
            username: undefined,
            password: null,
            host: '',
            port: undefined,
            pool: [Object],
            protocol: 'tcp',
            native: false,
            ssl: undefined,
            replication: false,
            dialectModule: null,
            dialectModulePath: null,
            keepDefaultTimezone: undefined,
            dialectOptions: {}
          },
          dialect: <ref *2> SqliteDialect {
            sequelize: [Circular *1],
            connectionManager: [Circular *4],
            queryGenerator: [SQLiteQueryGenerator],
            queryInterface: [Circular *3]
          },
          versionPromise: null,
          dialectName: 'sqlite',
          pool: Pool {
            log: false,
            idleTimeoutMillis: 10000,
            acquireTimeoutMillis: 60000,
            reapIntervalMillis: 1000,
            maxUsesPerResource: Infinity,
            _factory: [Object],
            _count: 0,
            _draining: false,
            _pendingAcquires: [],
            _inUseObjects: [],
            _availableObjects: [],
            _removeIdleScheduled: false
          },
          connections: { default: Database {} },
          lib: {
            Database: [Function: Database],
            Statement: [Function: Statement],
            Backup: [Function: Backup],
            OPEN_READONLY: 1,
            OPEN_READWRITE: 2,
            OPEN_CREATE: 4,
            OPEN_FULLMUTEX: 65536,
            OPEN_URI: 64,
            OPEN_SHAREDCACHE: 131072,
            OPEN_PRIVATECACHE: 262144,
            VERSION: '3.44.2',
            SOURCE_ID: '2023-11-24 11:41:44 ebead0e7230cd33bcec9f95d2183069565b9e709bf745c9b5db65cc0cbf92c0f',
            VERSION_NUMBER: 3044002,
            OK: 0,
            ERROR: 1,
            INTERNAL: 2,
            PERM: 3,
            ABORT: 4,
            BUSY: 5,
            LOCKED: 6,
            NOMEM: 7,
            READONLY: 8,
            INTERRUPT: 9,
            IOERR: 10,
            CORRUPT: 11,
            NOTFOUND: 12,
            FULL: 13,
            CANTOPEN: 14,
            PROTOCOL: 15,
            EMPTY: 16,
            SCHEMA: 17,
            TOOBIG: 18,
            CONSTRAINT: 19,
            MISMATCH: 20,
            MISUSE: 21,
            NOLFS: 22,
            AUTH: 23,
            FORMAT: 24,
            RANGE: 25,
            NOTADB: 26,
            LIMIT_LENGTH: 0,
            LIMIT_SQL_LENGTH: 1,
            LIMIT_COLUMN: 2,
            LIMIT_EXPR_DEPTH: 3,
            LIMIT_COMPOUND_SELECT: 4,
            LIMIT_VDBE_OP: 5,
            LIMIT_FUNCTION_ARG: 6,
            LIMIT_ATTACHED: 7,
            LIMIT_LIKE_PATTERN_LENGTH: 8,
            LIMIT_VARIABLE_NUMBER: 9,
            LIMIT_TRIGGER_DEPTH: 10,
            LIMIT_WORKER_THREADS: 11,
            path: '/opt/gpstracker/node_modules/sqlite3/build/Release/node_sqlite3.node',
            cached: [Object],
            verbose: [Function (anonymous)]
          }
        }
      },
      queryGenerator: <ref *5> SQLiteQueryGenerator {
        sequelize: <ref *1> Sequelize {
          options: {
            dialect: 'sqlite',
            dialectModule: null,
            dialectModulePath: null,
            host: '',
            protocol: 'tcp',
            define: {},
            query: {},
            sync: {},
            timezone: '+00:00',
            standardConformingStrings: true,
            logging: false,
            omitNull: false,
            native: false,
            replication: false,
            ssl: undefined,
            pool: {},
            quoteIdentifiers: true,
            hooks: {},
            retry: [Object],
            transactionType: 'DEFERRED',
            isolationLevel: null,
            databaseVersion: 0,
            typeValidation: false,
            benchmark: false,
            minifyAliases: false,
            logQueryParameters: false,
            attributeBehavior: 'throw',
            storage: '/var/opt/gpstracker/app.db',
            dialectOptions: [Object: null prototype] {}
          },
          config: {
            database: 'var/opt/gpstracker/app.db',
            username: undefined,
            password: null,
            host: '',
            port: undefined,
            pool: {},
            protocol: 'tcp',
            native: false,
            ssl: undefined,
            replication: false,
            dialectModule: null,
            dialectModulePath: null,
            keepDefaultTimezone: undefined,
            dialectOptions: [Object: null prototype] {}
          },
          dialect: <ref *2> SqliteDialect {
            sequelize: [Circular *1],
            connectionManager: [ConnectionManager],
            queryGenerator: [Circular *5],
            queryInterface: [Circular *3]
          },
          queryInterface: [Circular *3],
          models: { SequelizeMeta: [Function] },
          modelManager: ModelManager { models: [Array], sequelize: [Circular *1] },
          connectionManager: <ref *4> ConnectionManager {
            sequelize: [Circular *1],
            config: [Object],
            dialect: [SqliteDialect],
            versionPromise: null,
            dialectName: 'sqlite',
            pool: [Pool],
            connections: [Object],
            lib: [Object]
          }
        },
        options: {
          dialect: 'sqlite',
          dialectModule: null,
          dialectModulePath: null,
          host: '',
          protocol: 'tcp',
          define: {},
          query: {},
          sync: {},
          timezone: '+00:00',
          standardConformingStrings: true,
          logging: false,
          omitNull: false,
          native: false,
          replication: false,
          ssl: undefined,
          pool: {},
          quoteIdentifiers: true,
          hooks: {},
          retry: { max: 5, match: [Array] },
          transactionType: 'DEFERRED',
          isolationLevel: null,
          databaseVersion: 0,
          typeValidation: false,
          benchmark: false,
          minifyAliases: false,
          logQueryParameters: false,
          attributeBehavior: 'throw',
          storage: '/var/opt/gpstracker/app.db',
          dialectOptions: [Object: null prototype] {}
        },
        dialect: 'sqlite',
        _dialect: <ref *2> SqliteDialect {
          sequelize: <ref *1> Sequelize {
            options: [Object],
            config: [Object],
            dialect: [Circular *2],
            queryInterface: [Circular *3],
            models: [Object],
            modelManager: [ModelManager],
            connectionManager: [ConnectionManager]
          },
          connectionManager: <ref *4> ConnectionManager {
            sequelize: [Sequelize],
            config: [Object],
            dialect: [Circular *2],
            versionPromise: null,
            dialectName: 'sqlite',
            pool: [Pool],
            connections: [Object],
            lib: [Object]
          },
          queryGenerator: [Circular *5],
          queryInterface: [Circular *3]
        },
        _quoteIdentifier: [Function: quoteIdentifier],
        quoteIdentifier: [Function (anonymous)],
        OperatorMap: {
          [Symbol(eq)]: '=',
          [Symbol(ne)]: '!=',
          [Symbol(gte)]: '>=',
          [Symbol(gt)]: '>',
          [Symbol(lte)]: '<=',
          [Symbol(lt)]: '<',
          [Symbol(not)]: 'IS NOT',
          [Symbol(is)]: 'IS',
          [Symbol(in)]: 'IN',
          [Symbol(notIn)]: 'NOT IN',
          [Symbol(like)]: 'LIKE',
          [Symbol(notLike)]: 'NOT LIKE',
          [Symbol(iLike)]: 'ILIKE',
          [Symbol(notILike)]: 'NOT ILIKE',
          [Symbol(startsWith)]: 'LIKE',
          [Symbol(endsWith)]: 'LIKE',
          [Symbol(substring)]: 'LIKE',
          [Symbol(regexp)]: 'REGEXP',
          [Symbol(notRegexp)]: 'NOT REGEXP',
          [Symbol(iRegexp)]: '~*',
          [Symbol(notIRegexp)]: '!~*',
          [Symbol(between)]: 'BETWEEN',
          [Symbol(notBetween)]: 'NOT BETWEEN',
          [Symbol(overlap)]: '&&',
          [Symbol(contains)]: '@>',
          [Symbol(contained)]: '<@',
          [Symbol(adjacent)]: '-|-',
          [Symbol(strictLeft)]: '<<',
          [Symbol(strictRight)]: '>>',
          [Symbol(noExtendRight)]: '&<',
          [Symbol(noExtendLeft)]: '&>',
          [Symbol(any)]: 'ANY',
          [Symbol(all)]: 'ALL',
          [Symbol(and)]: ' AND ',
          [Symbol(or)]: ' OR ',
          [Symbol(col)]: 'COL',
          [Symbol(placeholder)]: '$$PLACEHOLDER$$',
          [Symbol(match)]: '@@'
        },
        typeValidation: undefined
      }
    }
  }
}

Node.js v20.16.0
Hi, I don't know much about Node so apologies if this is really obvious. I'm trying to set up GPSTracker without using Docker and when i run "npm run start" it's throwing up an error. I'm using sqlite as a DB and the installation appears to have had no errors up to this point. ``` bash-5.2$ npm run start > server@1.0.0 start > node dist/main.js ⌛ Syncing database Server is running on port 127.0.0.1:3000 { event: 'migrating', name: '000_initial.js' } { event: 'migrated', name: '000_initial.js', durationSeconds: 0.572 } { event: 'migrating', name: '001_add_metadata_to_location_points.js' } { event: 'migrated', name: '001_add_metadata_to_location_points.js', durationSeconds: 0.277 } { event: 'migrating', name: '000_initial.ts' } /opt/gpstracker/node_modules/umzug/lib/umzug.js:170 throw new MigrationError({ direction: 'up', ...params }, e); ^ MigrationError: Migration 000_initial.ts (up) failed: Original error: Unexpected token ':' TypeScript files can be required by adding `ts-node` as a dependency and calling `require('ts-node/register')` at the program entrypoint before running migrations. at /opt/gpstracker/node_modules/umzug/lib/umzug.js:170:27 at async Umzug.runCommand (/opt/gpstracker/node_modules/umzug/lib/umzug.js:126:20) at async Migrations.up (/opt/gpstracker/dist/db/Migrations.js:16:9) at async Db.sync (/opt/gpstracker/dist/db/Db.js:93:9) { cause: /opt/gpstracker/src/db/migrations/000_initial.ts:4 async function createUsersTable(query: { context: any }) { ^ SyntaxError: Unexpected token ':' at wrapSafe (node:internal/modules/cjs/loader:1281:20) at Module._compile (node:internal/modules/cjs/loader:1321:27) at Module._extensions..js (node:internal/modules/cjs/loader:1416:10) at Module.load (node:internal/modules/cjs/loader:1208:32) at Module._load (node:internal/modules/cjs/loader:1024:12) at Module.require (node:internal/modules/cjs/loader:1233:19) at require (node:internal/modules/helpers:179:18) at loadModule (/opt/gpstracker/node_modules/umzug/lib/umzug.js:391:34) at getModule (/opt/gpstracker/node_modules/umzug/lib/umzug.js:380:26) at Object.up (/opt/gpstracker/node_modules/umzug/lib/umzug.js:405:43), jse_cause: /opt/gpstracker/src/db/migrations/000_initial.ts:4 async function createUsersTable(query: { context: any }) { ^ SyntaxError: Unexpected token ':' at wrapSafe (node:internal/modules/cjs/loader:1281:20) at Module._compile (node:internal/modules/cjs/loader:1321:27) at Module._extensions..js (node:internal/modules/cjs/loader:1416:10) at Module.load (node:internal/modules/cjs/loader:1208:32) at Module._load (node:internal/modules/cjs/loader:1024:12) at Module.require (node:internal/modules/cjs/loader:1233:19) at require (node:internal/modules/helpers:179:18) at loadModule (/opt/gpstracker/node_modules/umzug/lib/umzug.js:391:34) at getModule (/opt/gpstracker/node_modules/umzug/lib/umzug.js:380:26) at Object.up (/opt/gpstracker/node_modules/umzug/lib/umzug.js:405:43), migration: { direction: 'up', name: '000_initial.ts', path: '/opt/gpstracker/src/db/migrations/000_initial.ts', context: <ref *3> SQLiteQueryInterface { sequelize: <ref *1> Sequelize { options: { dialect: 'sqlite', dialectModule: null, dialectModulePath: null, host: '', protocol: 'tcp', define: {}, query: {}, sync: {}, timezone: '+00:00', standardConformingStrings: true, logging: false, omitNull: false, native: false, replication: false, ssl: undefined, pool: {}, quoteIdentifiers: true, hooks: {}, retry: { max: 5, match: [Array] }, transactionType: 'DEFERRED', isolationLevel: null, databaseVersion: 0, typeValidation: false, benchmark: false, minifyAliases: false, logQueryParameters: false, attributeBehavior: 'throw', storage: '/var/opt/gpstracker/app.db', dialectOptions: [Object: null prototype] {} }, config: { database: 'var/opt/gpstracker/app.db', username: undefined, password: null, host: '', port: undefined, pool: {}, protocol: 'tcp', native: false, ssl: undefined, replication: false, dialectModule: null, dialectModulePath: null, keepDefaultTimezone: undefined, dialectOptions: [Object: null prototype] {} }, dialect: <ref *2> SqliteDialect { sequelize: [Circular *1], connectionManager: ConnectionManager { sequelize: [Circular *1], config: [Object], dialect: [Circular *2], versionPromise: null, dialectName: 'sqlite', pool: [Pool], connections: [Object], lib: [Object] }, queryGenerator: SQLiteQueryGenerator { sequelize: [Circular *1], options: [Object], dialect: 'sqlite', _dialect: [Circular *2], _quoteIdentifier: [Function: quoteIdentifier], quoteIdentifier: [Function (anonymous)], OperatorMap: [Object], typeValidation: undefined }, queryInterface: [Circular *3] }, queryInterface: [Circular *3], models: { SequelizeMeta: [class SequelizeMeta extends Model] { sequelize: [Circular *1], options: [Object], associations: {}, underscored: false, tableName: 'SequelizeMeta', _schema: null, _schemaDelimiter: '', rawAttributes: [Object], _indexes: [], primaryKeys: [Object], _readOnlyAttributes: Set(0) {}, _timestampAttributes: {}, _hasReadOnlyAttributes: false, _dataTypeChanges: {}, _dataTypeSanitizers: {}, _hasBooleanAttributes: false, _hasDateAttributes: false, _jsonAttributes: Set(0) {}, _virtualAttributes: Set(0) {}, _defaultValues: {}, fieldRawAttributesMap: [Object], uniqueKeys: [Object], fieldAttributeMap: {}, _hasJsonAttributes: false, _hasVirtualAttributes: false, _hasDefaultValues: false, tableAttributes: [Object], primaryKeyAttributes: [Array], primaryKeyAttribute: 'name', primaryKeyField: 'name', _hasPrimaryKeys: true, _isPrimaryKey: [Function (anonymous)], _attributeManipulation: [Object], autoIncrementAttribute: null, _scope: {}, _scopeNames: [Array], _overwrittenAttributesChecked: true } }, modelManager: ModelManager { models: [ [Function] ], sequelize: [Circular *1] }, connectionManager: <ref *4> ConnectionManager { sequelize: [Circular *1], config: { database: 'var/opt/gpstracker/app.db', username: undefined, password: null, host: '', port: undefined, pool: [Object], protocol: 'tcp', native: false, ssl: undefined, replication: false, dialectModule: null, dialectModulePath: null, keepDefaultTimezone: undefined, dialectOptions: {} }, dialect: <ref *2> SqliteDialect { sequelize: [Circular *1], connectionManager: [Circular *4], queryGenerator: [SQLiteQueryGenerator], queryInterface: [Circular *3] }, versionPromise: null, dialectName: 'sqlite', pool: Pool { log: false, idleTimeoutMillis: 10000, acquireTimeoutMillis: 60000, reapIntervalMillis: 1000, maxUsesPerResource: Infinity, _factory: [Object], _count: 0, _draining: false, _pendingAcquires: [], _inUseObjects: [], _availableObjects: [], _removeIdleScheduled: false }, connections: { default: Database {} }, lib: { Database: [Function: Database], Statement: [Function: Statement], Backup: [Function: Backup], OPEN_READONLY: 1, OPEN_READWRITE: 2, OPEN_CREATE: 4, OPEN_FULLMUTEX: 65536, OPEN_URI: 64, OPEN_SHAREDCACHE: 131072, OPEN_PRIVATECACHE: 262144, VERSION: '3.44.2', SOURCE_ID: '2023-11-24 11:41:44 ebead0e7230cd33bcec9f95d2183069565b9e709bf745c9b5db65cc0cbf92c0f', VERSION_NUMBER: 3044002, OK: 0, ERROR: 1, INTERNAL: 2, PERM: 3, ABORT: 4, BUSY: 5, LOCKED: 6, NOMEM: 7, READONLY: 8, INTERRUPT: 9, IOERR: 10, CORRUPT: 11, NOTFOUND: 12, FULL: 13, CANTOPEN: 14, PROTOCOL: 15, EMPTY: 16, SCHEMA: 17, TOOBIG: 18, CONSTRAINT: 19, MISMATCH: 20, MISUSE: 21, NOLFS: 22, AUTH: 23, FORMAT: 24, RANGE: 25, NOTADB: 26, LIMIT_LENGTH: 0, LIMIT_SQL_LENGTH: 1, LIMIT_COLUMN: 2, LIMIT_EXPR_DEPTH: 3, LIMIT_COMPOUND_SELECT: 4, LIMIT_VDBE_OP: 5, LIMIT_FUNCTION_ARG: 6, LIMIT_ATTACHED: 7, LIMIT_LIKE_PATTERN_LENGTH: 8, LIMIT_VARIABLE_NUMBER: 9, LIMIT_TRIGGER_DEPTH: 10, LIMIT_WORKER_THREADS: 11, path: '/opt/gpstracker/node_modules/sqlite3/build/Release/node_sqlite3.node', cached: [Object], verbose: [Function (anonymous)] } } }, queryGenerator: <ref *5> SQLiteQueryGenerator { sequelize: <ref *1> Sequelize { options: { dialect: 'sqlite', dialectModule: null, dialectModulePath: null, host: '', protocol: 'tcp', define: {}, query: {}, sync: {}, timezone: '+00:00', standardConformingStrings: true, logging: false, omitNull: false, native: false, replication: false, ssl: undefined, pool: {}, quoteIdentifiers: true, hooks: {}, retry: [Object], transactionType: 'DEFERRED', isolationLevel: null, databaseVersion: 0, typeValidation: false, benchmark: false, minifyAliases: false, logQueryParameters: false, attributeBehavior: 'throw', storage: '/var/opt/gpstracker/app.db', dialectOptions: [Object: null prototype] {} }, config: { database: 'var/opt/gpstracker/app.db', username: undefined, password: null, host: '', port: undefined, pool: {}, protocol: 'tcp', native: false, ssl: undefined, replication: false, dialectModule: null, dialectModulePath: null, keepDefaultTimezone: undefined, dialectOptions: [Object: null prototype] {} }, dialect: <ref *2> SqliteDialect { sequelize: [Circular *1], connectionManager: [ConnectionManager], queryGenerator: [Circular *5], queryInterface: [Circular *3] }, queryInterface: [Circular *3], models: { SequelizeMeta: [Function] }, modelManager: ModelManager { models: [Array], sequelize: [Circular *1] }, connectionManager: <ref *4> ConnectionManager { sequelize: [Circular *1], config: [Object], dialect: [SqliteDialect], versionPromise: null, dialectName: 'sqlite', pool: [Pool], connections: [Object], lib: [Object] } }, options: { dialect: 'sqlite', dialectModule: null, dialectModulePath: null, host: '', protocol: 'tcp', define: {}, query: {}, sync: {}, timezone: '+00:00', standardConformingStrings: true, logging: false, omitNull: false, native: false, replication: false, ssl: undefined, pool: {}, quoteIdentifiers: true, hooks: {}, retry: { max: 5, match: [Array] }, transactionType: 'DEFERRED', isolationLevel: null, databaseVersion: 0, typeValidation: false, benchmark: false, minifyAliases: false, logQueryParameters: false, attributeBehavior: 'throw', storage: '/var/opt/gpstracker/app.db', dialectOptions: [Object: null prototype] {} }, dialect: 'sqlite', _dialect: <ref *2> SqliteDialect { sequelize: <ref *1> Sequelize { options: [Object], config: [Object], dialect: [Circular *2], queryInterface: [Circular *3], models: [Object], modelManager: [ModelManager], connectionManager: [ConnectionManager] }, connectionManager: <ref *4> ConnectionManager { sequelize: [Sequelize], config: [Object], dialect: [Circular *2], versionPromise: null, dialectName: 'sqlite', pool: [Pool], connections: [Object], lib: [Object] }, queryGenerator: [Circular *5], queryInterface: [Circular *3] }, _quoteIdentifier: [Function: quoteIdentifier], quoteIdentifier: [Function (anonymous)], OperatorMap: { [Symbol(eq)]: '=', [Symbol(ne)]: '!=', [Symbol(gte)]: '>=', [Symbol(gt)]: '>', [Symbol(lte)]: '<=', [Symbol(lt)]: '<', [Symbol(not)]: 'IS NOT', [Symbol(is)]: 'IS', [Symbol(in)]: 'IN', [Symbol(notIn)]: 'NOT IN', [Symbol(like)]: 'LIKE', [Symbol(notLike)]: 'NOT LIKE', [Symbol(iLike)]: 'ILIKE', [Symbol(notILike)]: 'NOT ILIKE', [Symbol(startsWith)]: 'LIKE', [Symbol(endsWith)]: 'LIKE', [Symbol(substring)]: 'LIKE', [Symbol(regexp)]: 'REGEXP', [Symbol(notRegexp)]: 'NOT REGEXP', [Symbol(iRegexp)]: '~*', [Symbol(notIRegexp)]: '!~*', [Symbol(between)]: 'BETWEEN', [Symbol(notBetween)]: 'NOT BETWEEN', [Symbol(overlap)]: '&&', [Symbol(contains)]: '@>', [Symbol(contained)]: '<@', [Symbol(adjacent)]: '-|-', [Symbol(strictLeft)]: '<<', [Symbol(strictRight)]: '>>', [Symbol(noExtendRight)]: '&<', [Symbol(noExtendLeft)]: '&>', [Symbol(any)]: 'ANY', [Symbol(all)]: 'ALL', [Symbol(and)]: ' AND ', [Symbol(or)]: ' OR ', [Symbol(col)]: 'COL', [Symbol(placeholder)]: '$$PLACEHOLDER$$', [Symbol(match)]: '@@' }, typeValidation: undefined } } } } Node.js v20.16.0 ```
Owner

It looks like you haven't built the project. It's in Typescript, not JavaScript, so you'll have to compile the backend and frontend via make, and then start it via npm run start.

It looks like you haven't built the project. It's in Typescript, not JavaScript, so you'll have to compile the backend and frontend via make, and then start it via npm run start.
Author

Hmm, I have run make... Is it a version problem? It looks to me like my distro's nodejs is a bit out of date.

bash-5.2$ node --version
v20.16.0
bash-5.2$ tsc --version
Version 5.8.3
bash-5.2$ git clean -xdf
Removing .env
Removing dist/
Removing frontend/dist/
Removing frontend/node_modules/
Removing node_modules/
bash-5.2$ make
npm install && \
	npm run build
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm warn deprecated npmlog@6.0.2: This package is no longer supported.
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated are-we-there-yet@3.0.1: This package is no longer supported.
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated gauge@4.0.4: This package is no longer supported.

added 323 packages, and audited 324 packages in 3s

41 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

> server@1.0.0 build
> tsc

cd frontend && make
make[1]: Entering directory '/opt/gpstracker/frontend'
npm install && \
	npm run build
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead

added 635 packages, and audited 636 packages in 15s

181 packages are looking for funding
  run `npm fund` for details

2 moderate severity vulnerabilities

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> gpstracker@0.0.0 build
> run-p type-check "build-only {@}" --


> gpstracker@0.0.0 type-check
> vue-tsc --build


> gpstracker@0.0.0 build-only
> vite build

vite v6.2.4 building for production...
✓ 701 modules transformed.
dist/registerSW.js                  0.13 kB
dist/manifest.webmanifest           0.52 kB
dist/index.html                     0.55 kB │ gzip:   0.34 kB
dist/assets/index-oUTJLCl9.css    151.49 kB │ gzip:  14.23 kB
dist/assets/index-GlLZcobr.js   1,938.22 kB │ gzip: 619.06 kB

(!) Some chunks are larger than 500 kB after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
✓ built in 20.47s

PWA v1.0.0
mode      generateSW
precache  10 entries (2041.40 KiB)
files generated
  dist/sw.js
  dist/workbox-e3490c72.js
make[1]: Leaving directory '/opt/gpstracker/frontend'
bash-5.2$ cp ~/env.bak .env
bash-5.2$ npm run start

> server@1.0.0 start
> node dist/main.js

⌛ Syncing database
Server is running on port 127.0.0.1:3000
{ event: 'migrating', name: '000_initial.ts' }
/opt/gpstracker/node_modules/umzug/lib/umzug.js:170
                    throw new MigrationError({ direction: 'up', ...params }, e);
                          ^

MigrationError: Migration 000_initial.ts (up) failed: Original error: Unexpected token ':'

TypeScript files can be required by adding `ts-node` as a dependency and calling `require('ts-node/register')` at the program entrypoint before running migrations.
    at /opt/gpstracker/node_modules/umzug/lib/umzug.js:170:27
    at async Umzug.runCommand (/opt/gpstracker/node_modules/umzug/lib/umzug.js:126:20)
    at async Migrations.up (/opt/gpstracker/dist/db/Migrations.js:16:9)
    at async Db.sync (/opt/gpstracker/dist/db/Db.js:93:9) {
  cause: /opt/gpstracker/src/db/migrations/000_initial.ts:4
  async function createUsersTable(query: { context: any }) {
                                       ^
  
  SyntaxError: Unexpected token ':'
      at wrapSafe (node:internal/modules/cjs/loader:1281:20)
      at Module._compile (node:internal/modules/cjs/loader:1321:27)
      at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
<snip>
Hmm, I have run make... Is it a version problem? It looks to me like my distro's nodejs is a bit out of date. ``` bash-5.2$ node --version v20.16.0 bash-5.2$ tsc --version Version 5.8.3 bash-5.2$ git clean -xdf Removing .env Removing dist/ Removing frontend/dist/ Removing frontend/node_modules/ Removing node_modules/ bash-5.2$ make npm install && \ npm run build npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. npm warn deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs npm warn deprecated npmlog@6.0.2: This package is no longer supported. npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported npm warn deprecated are-we-there-yet@3.0.1: This package is no longer supported. npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported npm warn deprecated gauge@4.0.4: This package is no longer supported. added 323 packages, and audited 324 packages in 3s 41 packages are looking for funding run `npm fund` for details found 0 vulnerabilities > server@1.0.0 build > tsc cd frontend && make make[1]: Entering directory '/opt/gpstracker/frontend' npm install && \ npm run build npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported npm warn deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead added 635 packages, and audited 636 packages in 15s 181 packages are looking for funding run `npm fund` for details 2 moderate severity vulnerabilities To address all issues, run: npm audit fix Run `npm audit` for details. > gpstracker@0.0.0 build > run-p type-check "build-only {@}" -- > gpstracker@0.0.0 type-check > vue-tsc --build > gpstracker@0.0.0 build-only > vite build vite v6.2.4 building for production... ✓ 701 modules transformed. dist/registerSW.js 0.13 kB dist/manifest.webmanifest 0.52 kB dist/index.html 0.55 kB │ gzip: 0.34 kB dist/assets/index-oUTJLCl9.css 151.49 kB │ gzip: 14.23 kB dist/assets/index-GlLZcobr.js 1,938.22 kB │ gzip: 619.06 kB (!) Some chunks are larger than 500 kB after minification. Consider: - Using dynamic import() to code-split the application - Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks - Adjust chunk size limit for this warning via build.chunkSizeWarningLimit. ✓ built in 20.47s PWA v1.0.0 mode generateSW precache 10 entries (2041.40 KiB) files generated dist/sw.js dist/workbox-e3490c72.js make[1]: Leaving directory '/opt/gpstracker/frontend' bash-5.2$ cp ~/env.bak .env bash-5.2$ npm run start > server@1.0.0 start > node dist/main.js ⌛ Syncing database Server is running on port 127.0.0.1:3000 { event: 'migrating', name: '000_initial.ts' } /opt/gpstracker/node_modules/umzug/lib/umzug.js:170 throw new MigrationError({ direction: 'up', ...params }, e); ^ MigrationError: Migration 000_initial.ts (up) failed: Original error: Unexpected token ':' TypeScript files can be required by adding `ts-node` as a dependency and calling `require('ts-node/register')` at the program entrypoint before running migrations. at /opt/gpstracker/node_modules/umzug/lib/umzug.js:170:27 at async Umzug.runCommand (/opt/gpstracker/node_modules/umzug/lib/umzug.js:126:20) at async Migrations.up (/opt/gpstracker/dist/db/Migrations.js:16:9) at async Db.sync (/opt/gpstracker/dist/db/Db.js:93:9) { cause: /opt/gpstracker/src/db/migrations/000_initial.ts:4 async function createUsersTable(query: { context: any }) { ^ SyntaxError: Unexpected token ':' at wrapSafe (node:internal/modules/cjs/loader:1281:20) at Module._compile (node:internal/modules/cjs/loader:1321:27) at Module._extensions..js (node:internal/modules/cjs/loader:1416:10) <snip> ```
Author

Hi,

I've worked it out.

The glob in src/db/Migrations.ts is '**/db/migrations/*.*s', which picks up:

  • dist/db/migrations/000_initial.js
  • dist/db/migrations/001_add_metadata_to_location_points.js
  • src/db/migrations/000_initial.ts
  • src/db/migrations/001_add_metadata_to_location_points.ts

so it's balking on the ts files, which aren't needed.

Hi, I've worked it out. The glob in src/db/Migrations.ts is '**/db/migrations/*.*s', which picks up: * dist/db/migrations/000_initial.js * dist/db/migrations/001_add_metadata_to_location_points.js * src/db/migrations/000_initial.ts * src/db/migrations/001_add_metadata_to_location_points.ts so it's balking on the ts files, which aren't needed.
Owner

That's a good finding.

I can't reproduce this error - every time I've tested the db migration processes from scratch, even within Docker, Node ignores non-JS files if a .js is already available (not sure if it's a coincidence given by sorting).

But I think that it makes sense to only run migrations from .js files - including .ts file was mainly done to make migrations easier to develop, as they will be run directly from Typescript files when modifications are made, but if it's a good trade-off to pay for consistency.

I've pushed a commit that addresses this issue.

That's a good finding. I can't reproduce this error - every time I've tested the db migration processes from scratch, even within Docker, Node ignores non-JS files if a `.js` is already available (not sure if it's a coincidence given by sorting). But I think that it makes sense to only run migrations from `.js` files - including `.ts` file was mainly done to make migrations easier to develop, as they will be run directly from Typescript files when modifications are made, but if it's a good trade-off to pay for consistency. I've pushed a commit that addresses this issue.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: blacklight/gpstracker#1
No description provided.