内置电池,今天终于是换掉了。 充电周期,只有 27 次。 太难了。 联想笔记本的电池周期就 5 年。 https://www.isharkfly.com/t/topic/15936/3
内置电池,今天终于是换掉了。 充电周期,只有 27 次。 太难了。 联想笔记本的电池周期就 5 年。 https://www.isharkfly.com/t/topic/15936/3
每次构建成功的日志和记录可以在 GitHub 上查看到。 也正是这个原因,CF Page 的构建才要求只能使用 GitHub 和 Gitlab 的原因。 可能也是因为日志的问题。 https://www.isharkfly.com/t/github-cf-cf-github/17176
文件缓存文件夹将会被提交到 Git。 我们认为这个文件夹不应该被提交。 所以应该修改 git 的忽略文件,添加下面的内容: # vitepress build output .vitepress/cache 同时部署文件夹中来看,忽略这个文件夹不会影响构建部署。 https://www.isharkfly.com/t/vitepress-gitignore/17174
有时候,我们可能需要对 npm 在本地的配置进行查看和校验。 可以使用命令 npm config list 来显示配置信息。 针对我们当前运行的项目,我们输出的配置信息为: PS D:\WorkDir\Repository\iSharkfly-Docs\Docs\docs-isharkfly-com> npm config list ; "builtin" config from C:\Users\yhu\AppData\Roaming\npm\node_modules\npm\npmrc prefix = "C:\\Users\\yhu\\AppData\\Roaming\\npm" ; "user" config from C:\Users\yhu\.npmrc //repo.isharkfly.com/repository/npm-public/:_authToken = (protected) //repo.isharkfly.com/repository/npm/:_authToken = (protected) registry = "https://repo.isharkfly.com/repository/npm-public/" repo.isharkfly.com/repository/npm/:_authToken = "NpmToken.***" ; node bin location = C:\Program Files\nodejs\node.exe ; node version = v18.20.2 ; npm local prefix = D:\WorkDir\Repository\iSharkfly-Docs\Docs\docs-isharkfly-com ; npm version = 10.8.1 ; cwd = D:\WorkDir\Repository\iSharkfly-Docs\Docs\docs-isharkfly-com ; HOME = C:\Users\yhu ; Run `npm config ls -l` to show all defaults. PS D:\WorkDir\Repository\iSharkfly-Docs\Docs\docs-isharkfly-com> 从上面的配置信息,我们可以了解到程序安装时候使用的路径等。 以及使用的是那个库。 https://www.isharkfly.com/t/npm/17173
根据官方说法文章的链接:https://www.techsmith.com/learn/tutorials/snagit/arrow/ 还是需要使用箭头工具,然后选择 Bezier Curve 选择框。 然后就可以对直线进行调整了。 通过的是拖动的方式 https://www.isharkfly.com/t/snagit/17172
因 Docsify 部署的局限性,我们的文档库尝试使用不同的框架。 现在准备使用 vitepress,在这之前最后看看曾经部署过好几年的文档库吧。 好处感觉就是 Docsify 默认涉及内容能够全屏显示。 https://www.isharkfly.com/t/docsify/17169
可以把下面的代码添加到 vitepress 的 head 上来让 vitepress 网站使用 GTM。 例如,我们的内容是: head: [ [ 'script', {}, `(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-W3NL9V');` ] ], 随后重新部署下即可。 https://www.isharkfly.com/t/vitepress-gtm/17170
Vitepress 在默认情况下,将会搜索与 .vitepress 同级目录下的所有 md 文件然后进行转换。 如果想使用不同的目录的话,那么就需要参数: .srcDir: './src', 这样就可以把所有文件移动到 src 目录下了。 当完成上面的配置后,Vitepress 将会扫描 src 目录下的内容了。 https://www.isharkfly.com/t/vitepress/17171
构建的错误信息如下: 09:52:57.975 ➤ YN0000: · Done with warnings in 3s 120ms 09:52:58.072 Executing user command: npm run build 09:52:58.817 npm ERR! Missing script: "build" 09:52:58.818 npm ERR! 09:52:58.818 npm ERR! To see a list of scripts, run: 09:52:58.818 npm ERR! npm run 09:52:58.818 09:52:58.819 npm ERR! A complete log of this run can be found in: /opt/buildhome/.npm/_logs/2025-04-10T13_52_58_752Z-debug-0.log 09:52:58.825 Failed: Error while executing user command. Exited with error code: 1 问题和解决 上面的问题是在执行构建的时候 VitePress 的构建命令不是 npm run build。 这个构建命令需要改成:npm run docs:build 在 cloudflare page 中选择构建配置。 然后单击编辑按钮, 有 2 个地方要修改。 一个是构建的命令,一个是构建完成后输出文件夹的路径。 如果dist 文件夹的路径不修改,后面会提示部署找不到需要部署的文件。 https://www.isharkfly.com/t/vitepress-cloudflare-page-npm-run-build/17166
提示的构建错误信息为: 09:35:29.838 Error: Exit with error code: 1 09:35:29.839 at ChildProcess.<anonymous> (/snapshot/dist/run-build.js) 09:35:29.839 at Object.onceWrapper (node:events:652:26) 09:35:29.839 at ChildProcess.emit (node:events:537:28) 09:35:29.840 at ChildProcess._handle.onexit (node:internal/child_process:291:12) 09:35:29.847 Failed: build command exited with code: 1 原因和解决 提示上面错误信息的原因是 Yarn 的版本问题。 在默认 NodeJS 的安装情况下,Yarn 会安装 1.22 的版本。 但在cloudflare 构建中,默认会使用 Yarn 3 的版本。 在日志的最上部分,提示了安装 Yarn 的版本信息。 09:35:26.187 No wrangler.toml file found. Continuing. 09:35:26.253 Detected the following tools from environment: yarn@3.6.3, nodejs@18.17.1 因此解决办法就是针对 VitePress 项目指定使用 yarn 的版本。 运行命令来进行升级: yarn set version stable 控制台输出: PS D:\WorkDir\iSharkFly\iSharkFly-Cn\docs-hn> yarn set version stable ➤ YN0000: Downloading https://repo.yarnpkg.com/4.9.1/packages/yarnpkg-cli/bin/yarn.js ➤ YN0000: Saving the new release in .yarn/releases/yarn-4.9.1.cjs ➤ YN0000: Done in 0s 195ms PS D:\WorkDir\iSharkFly\iSharkFly-Cn\docs-hn> yarn -v 4.9.1 PS D:\WorkDir\iSharkFly\iSharkFly-Cn\docs-hn> 随后推送,重新部署即可。 https://www.isharkfly.com/t/vitepress-cloudflare-page-node/17165