统计学

安装umami的坎坷经历

D:\gattefosse\umami>yarn build
yarn run v1.22.21
$ npm-run-all check-env build-db check-db build-tracker build-geo build-app
$ node scripts/check-env.js
$ npm-run-all copy-db-files build-db-client
$ node scripts/copy-db-files.js
Database type detected: mysql
Copied D:\gattefosse\umami\db\mysql to D:\gattefosse\umami\prisma
$ prisma generate
Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma

✔ Generated Prisma Client (v5.9.1) to .\node_modules\@prisma\client in 436ms

Start using Prisma Client in Node.js (See: https://pris.ly/d/client)
```
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
```
or start using Prisma Client at the edge (See: https://pris.ly/d/accelerate)
```
import { PrismaClient } from '@prisma/client/edge'
const prisma = new PrismaClient()
```

See other ways of importing Prisma Client: http://pris.ly/d/importing-client

┌─────────────────────────────────────────────────────────────┐
│  Deploying your app to serverless or edge functions?        │
│  Try Prisma Accelerate for connection pooling and caching.  │
│  https://pris.ly/cli/accelerate                             │
└─────────────────────────────────────────────────────────────┘

$ node scripts/check-db.js
✓ DATABASE_URL is defined.
✓ Database connection successful.
✓ Database version check successful.
Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Datasource "db": MySQL database "gattefosse" at "192.168.1.9:33906"

4 migrations found in prisma/migrations


No pending migrations to apply.

✓ Database is up to date.
$ rollup -c rollup.tracker.config.mjs

src/tracker/index.js → public/script.js...
created public/script.js in 1.6s
$ node scripts/build-geo.js
node:events:496
      throw er; // Unhandled 'error' event
      ^

Error: getaddrinfo ENOENT raw.githubusercontent.com
    at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:118:26)
Emitted 'error' event on ClientRequest instance at:
    at TLSSocket.socketErrorListener (node:_http_client:495:9)
    at TLSSocket.emit (node:events:518:28)
    at emitErrorNT (node:internal/streams/destroy:169:8)
    at emitErrorCloseNT (node:internal/streams/destroy:128:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'getaddrinfo',
  hostname: 'raw.githubusercontent.com'
}

Node.js v20.11.1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "build-geo" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

D:\gattefosse\umami>node -v
v20.11.1

D:\gattefosse\umami>npm -v
10.2.4

解决办法:

修改C:\Windows\System32\drivers\etc\hosts,把复制的IP添加进去,保存

1

185.199.111.133 raw.githubusercontent.com

转自:https://www.cnblogs.com/zsg88/p/17768809.html 

 

另注:umami的统计js需要用https,才能在https的网站下正常调用

umami免费版只能使用6个月,之后统计接口api/send 请求的返回会变成400,从而不能继续实现统计,如果要持续,需要20美金一个月.........前期没有调查好。让老板觉得被坑了,且显得本技术员不够专业