51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

Nodejs报错记录

digital envelope routines::unsupported {#◉-digital-envelope-routines-unsupported}

|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 1 2 3 4 5 6 | D:\workspace\vuedemo> npm run dev ... error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:71:19) at Object.createHash (node:crypto:133:10) ... |

Nodejs升级到17版本以上时,运行之前的webpack项目会出现此问题。详情查看 github

解决办法有两种:

  1. 修改 package.json,在相关构建命令之前加入 set NODE_OPTIONS=--openssl-legacy-provider &

    |-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 1 2 3 4 5 | "scripts": { "serve": "set NODE_OPTIONS=--openssl-legacy-provider & vue-cli-service serve", "build": "set NODE_OPTIONS=--openssl-legacy-provider & vue-cli-service build", "lint": "set NODE_OPTIONS=--openssl-legacy-provider & vue-cli-service lint" } |

  2. 回退Nodejs版本,可以使用 nvm管理工具,管理多个Nodejs版本。

◉ 终端输入vue -V 报错 在此系统上禁止运行脚本 {#◉-终端输入vue-V-报错-在此系统上禁止运行脚本}

|-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 1 2 3 4 5 6 7 | C:\Users\Administrator> vue -V vue : 无法加载文件 D:\nodejs\node_global\vue.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。 所在位置 行:1 字符: 1 + vue -V + ~~~ + CategoryInfo : SecurityError: (:) [],PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess |

解决办法:

  1. 使用管理员模式启动终端
  2. 执行命令:get-ExecutionPolicy(取得shell的当前执行策略),显示 Restricted(表示状态是禁止的)
  3. 执行命令:set-ExecutionPolicy RemoteSigned
  4. 执行命令:get-ExecutionPolicy,显示 RemoteSigned 则可以正常使用了

Node Sass does not yet support your current environment {#◉-Node-Sass-does-not-yet-support-your-current-environment}

|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 1 2 3 | Syntax Error: Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (108) For more information on which environments are supported please see: https://github.com/sass/node-sass/releases/tag/v4.14.1 |

node sass 版本和当前node版本不匹配,点击查看匹配版本
解决办法:

  1. 卸载当前版本 node sass

    |-----------|----------------------------------------| | 1 | npm uninstall --save node-sass |

  2. 安装对应版本的 node sass

    |-----------|-----------------------------------------| | 1 | npm install --save node-sass@版本 |

npm ERR! Invalid name: "xxx" {#◉-npm-ERR-Invalid-name-quot-xxx-quot}

|-------------|------------------------------------------------------------------------------------------------------------| | 1 2 | PS D:\workspace\2023\scheduling-screeen> npm run serve npm ERR! Invalid name: "scheduling screeen" |

npm在发布时,package.jsonname 属性值不准许有大写字母和空格,这。。。
解决办法:
修改 package.json 文件中 name 的名称

|-----------------|-----------------------------------------------| | 1 2 3 4 | { "name": "scheduling screeen", ... } |


赞(0)
未经允许不得转载:工具盒子 » Nodejs报错记录