本地运行nav导航(弃用,编辑功能有bug)

130 次阅读

本文最后更新于 2026年5月11日。

npm非常容易失败

E:\mydoc\code\nav-main>npm install
npm warn cleanup Failed to remove some directories [
npm warn cleanup   [
npm warn cleanup     '\\\\?\\E:\\mydoc\\code\\nav-main\\node_modules\\@angular',
npm warn cleanup     [Error: EPERM: operation not permitted, rmdir 'E:\mydoc\code\nav-main\node_modules\@angular\compiler-cli\src\ngtsc\resource\src'] {
npm warn cleanup       errno: -4048,
npm warn cleanup       code: 'EPERM',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: 'E:\\mydoc\\code\\nav-main\\node_modules\\@angular\\compiler-cli\\src\\ngtsc\\resource\\src'
npm warn cleanup     }
npm warn cleanup   ]
npm warn cleanup ]
npm error code 1
npm error path E:\mydoc\code\nav-main\node_modules\puppeteer
npm error command failed
npm error command C:\WINDOWS\system32\cmd.exe /d /s /c node install.mjs
npm error **INFO** Skipping Firefox download as instructed.
npm error Error: ERROR: Failed to set up chrome-headless-shell v140.0.7339.82! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
npm error     at downloadBrowser (file:///E:/mydoc/code/nav-main/node_modules/puppeteer/lib/esm/puppeteer/node/install.js:26:15)
npm error     at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
npm error     at async Promise.all (index 1)
npm error     at async downloadBrowsers (file:///E:/mydoc/code/nav-main/node_modules/puppeteer/lib/esm/puppeteer/node/install.js:84:9) {
npm error   [cause]: Error: read ECONNRESET
npm error       at TLSWrap.onStreamRead (node:internal/stream_base_commons:216:20) {
npm error     errno: -4077,
npm error     code: 'ECONNRESET',
npm error     syscall: 'read'
npm error   }
npm error }
npm error A complete log of this run can be found in: C:\Users\weiyo\AppData\Local\npm-cache\_logs\2025-09-17T12_26_13_192Z-debug-0.log

pnpm也失败了

E:\mydoc\code\nav-main>pnpm install

   ╭───────────────────────────────────────────────────────────────────╮
   │                                                                   │
   │                Update available! 8.7.0 → 10.16.1.                 │
   │   Changelog: https://github.com/pnpm/pnpm/releases/tag/v10.16.1   │
   │                 Run "pnpm add -g pnpm" to update.                 │
   │                                                                   │
   │      Follow @pnpmjs for updates: https://twitter.com/pnpmjs       │
   │                                                                   │
   ╰───────────────────────────────────────────────────────────────────╯

 WARN  Ignoring broken lockfile at E:\mydoc\code\nav-main: Lockfile E:\mydoc\code\nav-main\pnpm-lock.yaml not compatible with current pnpm
Downloading registry.npmmirror.com/@oxlint/win32-x64/1.16.0: 7.34 MB/7.34 MB, done
Downloading registry.npmmirror.com/@img/sharp-win32-x64/0.34.3: 8.53 MB/8.53 MB, done
Downloading registry.npmmirror.com/@rolldown/binding-win32-x64-msvc/1.0.0-beta.32: 7.45 MB/7.45 MB, done
Packages: +1056
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 1205, reused 249, downloaded 810, added 1056, done
node_modules/.pnpm/@tailwindcss+oxide@4.1.13/node_modules/@tailwindcss/oxide: Running postinstall script, done in 135ms
node_modules/.pnpm/@parcel+watcher@2.5.1/node_modules/@parcel/watcher: Running install script, done in 59ms
node_modules/.pnpm/msgpackr-extract@3.0.3/node_modules/msgpackr-extract: Running install script, done in 181ms
node_modules/.pnpm/esbuild@0.25.9/node_modules/esbuild: Running postinstall script, done in 222ms
node_modules/.pnpm/sharp@0.34.3/node_modules/sharp: Running install script, done in 82ms
node_modules/.pnpm/lmdb@3.4.2/node_modules/lmdb: Running install script, done in 143ms
node_modules/.pnpm/puppeteer@24.22.0_typescript@5.9.2/node_modules/puppeteer: Running postinstall script, failed in 1.5s
.../node_modules/puppeteer postinstall$ node install.mjs
│ **INFO** Skipping Firefox download as instructed.
│ Error: ERROR: Failed to set up chrome v140.0.7339.82! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
│     at downloadBrowser (file:///E:/mydoc/code/nav-main/node_modules/.pnpm/puppeteer@24.22.0_typescript@5.9.2/node_m…
│     at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
│     at async Promise.all (index 0)
│     at async downloadBrowsers (file:///E:/mydoc/code/nav-main/node_modules/.pnpm/puppeteer@24.22.0_typescript@5.9.2…
│   [cause]: Error: read ECONNRESET
│       at TLSWrap.onStreamRead (node:internal/stream_base_commons:216:20) {
│     errno: -4077,
│     code: 'ECONNRESET',
│     syscall: 'read'
│   }
│ }
└─ Failed in 1.5s at E:\mydoc\code\nav-main\node_modules\.pnpm\puppeteer@24.22.0_typescript@5.9.2\node_modules\puppeteer
 ELIFECYCLE  Command failed with exit code 1.

跳过chrome下载就好了

E:\mydoc\code\nav-main>set PUPPETEER_SKIP_DOWNLOAD=true && pnpm install
 WARN  Ignoring broken lockfile at E:\mydoc\code\nav-main: Lockfile E:\mydoc\code\nav-main\pnpm-lock.yaml not compatible with current pnpm
Packages: +1056
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 1205, reused 1059, downloaded 0, added 0, done
node_modules/.pnpm/@tailwindcss+oxide@4.1.13/node_modules/@tailwindcss/oxide: Running postinstall script, done in 127ms
node_modules/.pnpm/@parcel+watcher@2.5.1/node_modules/@parcel/watcher: Running install script, done in 63ms
node_modules/.pnpm/esbuild@0.25.9/node_modules/esbuild: Running postinstall script, done in 135ms
node_modules/.pnpm/msgpackr-extract@3.0.3/node_modules/msgpackr-extract: Running install script, done in 150ms
node_modules/.pnpm/sharp@0.34.3/node_modules/sharp: Running install script, done in 80ms
node_modules/.pnpm/lmdb@3.4.2/node_modules/lmdb: Running install script, done in 126ms
node_modules/.pnpm/puppeteer@24.22.0_typescript@5.9.2/node_modules/puppeteer: Running postinstall script, done in 192ms

dependencies:
+ @angular/animations 20.3.0
+ @angular/common 20.3.0
+ @angular/compiler 20.3.0
+ @angular/core 20.3.0
+ @angular/forms 20.3.0
+ @angular/platform-browser 20.3.0
+ @angular/platform-browser-dynamic 20.3.0
+ @angular/router 20.3.0
+ @angular/service-worker 20.3.0
+ axios 1.12.2
+ chrome-finder 1.0.7
+ cron 4.3.3
+ dayjs 1.11.18
+ express 5.1.0
+ file-saver 2.0.5
+ js-base64 3.7.8
+ js-yaml 4.1.0
+ localforage 1.10.0
+ lz-string 1.5.0
+ mitt 3.0.1
+ ng-zorro-antd 20.3.1
+ nprogress 0.2.0
+ puppeteer 24.22.0
+ qs 6.14.0
+ rough-notation 0.5.1
+ rxjs 7.8.2
+ sharp 0.34.3
+ zone.js 0.15.1

devDependencies:
+ @angular-devkit/build-angular 20.3.1
+ @angular/cli 20.3.1
+ @angular/compiler-cli 20.3.0
+ @tailwindcss/postcss 4.1.13
+ @types/compression 1.8.1
+ @types/file-saver 2.0.7
+ @types/jasmine 5.1.9
+ @types/js-yaml 4.0.9
+ @types/nodemailer 7.0.1
+ @types/nprogress 0.2.3
+ @types/qs 6.14.0
+ body-parser 2.2.0
+ compression 1.8.1
+ connect-history-api-fallback 2.0.0
+ cors 2.8.5
+ info-web 0.0.46 (0.0.48 is available)
+ jasmine-core 5.10.0
+ lint-staged 16.1.6
+ nodemailer 7.0.6
+ oxlint 1.16.0
+ pm2 6.0.11
+ postcss 8.5.6
+ prettier 3.6.2
+ tailwindcss 4.1.13
+ tslib 2.8.1
+ tsx 4.20.5
+ typescript 5.9.2

Done in 36.4s

运行本地服务成功

E:\mydoc\code\nav-main>pnpm run start

> nav@17.0.0 start E:\mydoc\code\nav-main
> npm run init && ng serve --host 0.0.0.0 --port=7002 --live-reload=false


> nav@17.0.0 init
> tsx ./scripts/start.ts


Would you like to share pseudonymous usage data about this project with the Angular Team
at Google under Google's Privacy Policy at https://policies.google.com/privacy. For more
details and how to change this setting, see https://angular.dev/cli/analytics.

   No
Global setting: not set
Local setting: disabled
Effective status: disabled

Warning: This is a simple server for use in testing or debugging Angular applications
locally. It hasn't been reviewed for security issues.

Binding this server to an open connection can result in compromising your application or
computer. Using a different host than the one passed to the "--host" flag might result in
websocket connection issues. You might need to use "--disable-host-check" if that's the
case.

Initial chunk files | Names           |  Raw size
styles.css          | styles          | 790.60 kB |
main.js             | main            | 433.15 kB |
chunk-2TRUNMWG.js   | -               | 307.21 kB |
chunk-XYOGX4FL.js   | -               |  81.79 kB |
chunk-EGJJEXTA.js   | -               |  77.10 kB |
chunk-VFPDD5FK.js   | -               |  19.82 kB |
chunk-VT7IICM2.js   | -               |  19.33 kB |
chunk-VVNA5GHT.js   | -               |  15.82 kB |
chunk-33EEU5UF.js   | -               |   5.87 kB |
chunk-7SNOCXFW.js   | -               |   5.16 kB |
chunk-OMBQZLNO.js   | -               |   3.94 kB |
chunk-TNK2CEVY.js   | -               |   1.74 kB |
chunk-HCH5BPEX.js   | -               |   1.20 kB |
polyfills.js        | polyfills       |  95 bytes |

                    | Initial total   |   1.76 MB

Lazy chunk files    | Names           |  Raw size
chunk-DN2SSQWK.js   | index-component | 159.92 kB |
chunk-SQN2XJHT.js   | index-component | 144.98 kB |
chunk-HQIJAWRI.js   | index-component |  83.47 kB |
chunk-7IWXTOM3.js   | index-component |  39.31 kB |
chunk-6EPSLCGB.js   | index-component |  30.66 kB |
chunk-BTD2RA5H.js   | index-component |  27.73 kB |
chunk-MZ7N4YSY.js   | index-component |  19.31 kB |
chunk-DLS5E44N.js   | index-component |  12.42 kB |
chunk-BFDRPPZZ.js   | index-component |  10.85 kB |
chunk-HJFZTQTK.js   | index-component |  10.60 kB |
chunk-G6LUBLET.js   | index-component |   5.71 kB |
chunk-T5ABMWVB.js   | index-component |   5.33 kB |
chunk-6YZERTSR.js   | -               | 578 bytes |

Application bundle generation complete. [7.084 seconds] - 2025-09-17T12:54:13.384Z

Watch mode enabled. Watching for file changes...
NOTE: Raw file sizes do not reflect development server per-request transformations.
  ➜  Local:   http://localhost:7002/
  ➜  Network: http://100.64.0.2:7002/
  ➜  Network: http://10.10.10.2:7002/
  ➜  Network: http://192.168.80.1:7002/
  ➜  Network: http://10.3.3.3:7002/
  ➜  Network: http://10.0.0.3:7002/
  ➜  Network: http://192.168.10.90:7002/
  ➜  press h + enter to show help

这种情况运行或者打包后后台需要token

E:\mydoc\code\nav-main\src\utils\utils.ts

中export const isSelfDevelop = !!navConfig.address
改成 export const isSelfDevelop = ture

怎么改都不行

我如果把打包后的chunk-P3CA3PG4.js文件中地址填上我的docker部署好的nav就能用部署好的后台,密码也正常用address:"https://nav.weiyoun.com/"
挺有意思。