记一次安装 pnpm 问题

过程如下
在位置 行:1 字符: 1
+ yarn install
+ ~~~~
    + CategoryInfo          : SecurityError: (:) [],PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
PS D:\CompanyProject\xrrb\work_daily_report_front> yarn install
所在位置 行:1 字符: 1
+ ~~~~
    + CategoryInfo          : SecurityError: (:) [],PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
yarn : 无法加载文件 C:\Users\cfl19\AppData\Roaming\npm\yarn.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsof
所在位置 行:1 字符: 1
+ yarn install
+ ~~~~
    + CategoryInfo          : SecurityError: (:) [],PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
PS D:\CompanyProject\xrrb\work_daily_report_front> yarn install

Presence of the "packageManager" field indicates that the project is meant to be used with Corepack, a tool included by default with
Corepack must currently be enabled by running corepack enable in your terminal. For more information, check out https://yarnpkg.com/
 ERROR  This project is configured to use ^pnpm
PS D:\CompanyProject\xrrb\work_daily_report_front> pnpm install
 ERROR  This project is configured to use ^pnpm
For help, run: pnpm help install
 ERROR  This project is configured to use ^pnpm
For help, run: pnpm help help

changed 1 package in 3s

1 package is looking for funding
  run `npm fund` for details
PS D:\CompanyProject\xrrb\work_daily_report_front> pnpm install
 ERROR  This project is configured to use ^pnpm
PS D:\CompanyProject\xrrb\work_daily_report_front> pnpm install
 ERROR  This project is configured to use ^pnpm
PS D:\CompanyProject\xrrb\work_daily_report_front> nvm install 16.20.0
Downloading node.js version 16.20.0 (64-bit)...
Extracting node and npm...
Complete
Installation complete.
If you want to use this version, type:

nvm use 16.20.0
PS D:\CompanyProject\xrrb\work_daily_report_front> nvm use 16.20.0
PS D:\CompanyProject\xrrb\work_daily_report_front> pnpm store prune
ERROR: This version of pnpm requires at least Node.js v18.12
The current version of Node.js is v16.20.0
Visit https://r.pnpm.io/comp to see the list of past pnpm versions with respective Node.js version support.
PS D:\CompanyProject\xrrb\work_daily_report_front> nvm install 18.12
Downloading node.js version 18.12.1 (64-bit)...
Extracting node and npm...
Complete
If you want to use this version, type:

nvm use 18.12.1
PS D:\CompanyProject\xrrb\work_daily_report_front> pnpm store prune 
ERROR: This version of pnpm requires at least Node.js v18.12
The current version of Node.js is v16.20.0
Visit https://r.pnpm.io/comp to see the list of past pnpm versions with respective Node.js version support.
PS D:\CompanyProject\xrrb\work_daily_report_front> nvm use 18.12
Now using node v18.12.1 (64-bit)
PS D:\CompanyProject\xrrb\work_daily_report_front> pnpm store prune
Removed all cached metadata files
Removed 0 files
Removed 0 packages
PS D:\CompanyProject\xrrb\work_daily_report_front> pnpm install
 ERROR  This project is configured to use ^pnpm
For help, run: pnpm help install
PS D:\CompanyProject\xrrb\work_daily_report_front> Remove-Item yarn.lock
Remove-Item : 找不到路径“D:\CompanyProject\xrrb\work_daily_report_front\yarn.lock”,因为该路径不存在。
所在位置 行:1 字符: 1
+ Remove-Item yarn.lock
+ ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (D:\CompanyProje...front\yarn.lock:String) [Remove-Item], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand
 
PS D:\CompanyProject\xrrb\work_daily_report_front> pnpm install
 ERROR  This project is configured to use ^pnpm
For help, run: pnpm help install
PS D:\CompanyProject\xrrb\work_daily_report_front> npm install -g pnpm@8.15.1

added 1 package, and audited 3 packages in 5s

1 moderate severity vulnerability

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
PS D:\CompanyProject\xrrb\work_daily_report_front>   npm audit fix --force
npm WARN using --force Recommended protections disabled.
npm ERR! code ENOLOCK
npm ERR! audit This command requires an existing lockfile.
npm ERR! audit Try creating one first with: npm i --package-lock-only
npm ERR! audit Original error: loadVirtual requires existing shrinkwrap file

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\cfl19\AppData\Local\npm-cache\_logs\2025-08-24T13_22_49_880Z-debug-0.log
PS D:\CompanyProject\xrrb\work_daily_report_front> pnpm install

   ╭───────────────────────────────────────────────────────────────────╮
   │                                                                   │
   │                Update available! 8.15.1 → 10.15.0.                │
   │   Changelog: https://github.com/pnpm/pnpm/releases/tag/v10.15.0   │
   │                 Run "pnpm add -g pnpm" to update.                 │
   │                                                                   │
   │      Follow @pnpmjs for updates: https://twitter.com/pnpmjs       │
   │                                                                   │
   ╰───────────────────────────────────────────────────────────────────╯
image.png
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容