Nodejs/编程语言

【nodejs】开发笔记—-错误登记表

daimafengzi · 1月10日 · 2025年 · · · 本文共1924个字 · 预计阅读7分钟40次已读

问题一

generateDocx.js执行生成时报错

nodejs笔记】文档生成失败: 执行错误: Command failed: java -cp “aspose-words-20.12-jdk17-cracked.jar:.” UpdateTableOfContents 1736492468991-6544.docx

解决方案

#Linux下的生成语句:
const command = `java -cp "${jarPath}:." UpdateTableOfContents ${fileName}`;
#Windows下的生成语句:
const command = `java -cp "${jarPath};." UpdateTableOfContents ${fileName}`;

问题二

执行nmp报错,设置淘宝源报错

npm : 无法加载文件 D:\JAVA\nodejs\npm.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的
 about_Execution_Policies。
所在位置 行:1 字符: 1
+ npm config set registry https://registry.npmmirror.com
+ ~~~
    + CategoryInfo          : SecurityError: (:) [],PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

解决方案

删除D:\JAVA\nodejs\npm.ps1这个文件重新执行!

yarn dev无法执行

报错内容

D:\JAVA\IdeaProjects\design-node-service> yarn dev
yarn : 无法将“yarn”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。
所在位置 行:1 字符: 1
+ yarn dev
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (yarn:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

解决办法

1.通过 npm 安装 Yarn

npm install --global yarn

2. 验证安装:

yarn --version

如果报错

D:\JAVA\IdeaProjects\design-node-service> yarn --version
yarn : 无法加载文件 C:\Users\Administrator\AppData\Roaming\npm\yarn.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft. 
com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
所在位置 行:1 字符: 1
+ yarn --version
+ ~~~~
    + CategoryInfo          : SecurityError: (:) [],PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

解决办法,删除C:\Users\Administrator\AppData\Roaming\npm\yarn.ps1再执行!

执行yarn dev 或者 npm dev报错

报错问题

D:\JAVA\IdeaProjects\design-node-service> yarn dev
yarn run v1.22.22
$ egg-bin dev
'egg-bin' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

解决办法

确认项目依赖已安装

首先确保你已经安装了所有必要的 npm/yarn 依赖包。在你的项目目录(即 D:\JAVA\IdeaProjects\design-node-service)下运行以下命令来安装所有依赖:

yarn install

或者

npm install

尝试全局安装 egg-bin

如果问题依旧存在,你可以尝试全局安装 egg-bin,尽管这不是推荐的做法,因为它可能导致版本冲突的问题:

yarn global add egg

或者使用 npm:

npm install -g egg
0 条回应
| 耗时 0.514 秒 | 查询 60 次 | 内存 4.26 MB |
本站CDN由One degree CDN提供