卡在 idealTree:globby: sill fetch manifest type-fest@^0.20.2
npm set strict-ssl false 无效
npm install -g npm 升级到最新版本命令 已经是最新,无效
没用,可以看到错误信息
npm config set registry https://registry.npm.taobao.org/
npm cache clear --force
npm install --verbose
发现问题,下面这个循环打印, 看样子问题出在 ajv-keywords
npm timing idealTree:node_modules/_ajv-keywords@3.5.2@ajv-keywords Completed in 6ms
npm timing idealTree:node_modules/_ajv-keywords@2.1.1@ajv-keywords Completed in 5ms
将 node_modules清空, 单独安装 ajv-keywords, 仍然报错, 发现node-saas老生常谈的错误出来了
npm ERR! path D:\codes\LarkMidTable\larkmidtable-ui\node_modules\node-sass
npm ERR! command failed
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
尝试升级 npm i node-sass@6.0.1 , 报错
看到了报错
npm ERR! path D:\codes\LarkMidTable\larkmidtable-ui\node_modules\node-sass
npm ERR! command failed
gyp verb `which` failed Error: not found: python2
尝试安装
npm install --global windows-build-tools
卡住了,加上 --verbose运行查看运行过程
npm install --global windows-build-tools
报警告
npm WARN deprecated windows-build-tools@5.2.2: Node.js now includes build tools for Windows. You probably no longer need this tool. See https://github.com/felixrieseberg/windows-build-tools for details.
意思是已经包含这个工具了, 那么现在问题就是缺少python2, 手工安装吧
不甘心, npm怎么需要用户手工安装python2呢?
重新安装报错
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/nhn/raphael.git
npm ERR! git@github.com: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
解决方案
在终端中输入: 将 ssh 下载方式改成 https
git config --global url."https://".insteadOf ssh://git
仍然无效,报错表明无法下载, 怀疑是网络问题,科学上网安排上接着编译
报错 node-sass , 这个经典的错误好解决
npm ERR! code 1
npm ERR! path D:\codes\LarkMidTable\larkmidtable-ui\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/install.js
npm ERR! node:internal/modules/cjs/loader:1197
npm ERR! throw err;
npm ERR! ^
npm ERR!
npm ERR! SyntaxError: D:\codes\LarkMidTable\larkmidtable-ui\node_modules\har-schema\lib\query.json: Unexpected end of JSON input
npm ERR! at parse (<anonymous>)
npm ERR! at Object.Module._extensions..json (node:internal/modules/cjs/loader:1194:22)
npm ERR! at Module.load (node:internal/modules/cjs/loader:1004:32)
npm ERR! at Function.Module._load (node:internal/modules/cjs/loader:839:12)
npm ERR! at Module.require (node:internal/modules/cjs/loader:1028:19)
npm ERR! at require (node:internal/modules/cjs/helpers:102:18)
npm ERR! at Object.<anonymous> (D:\codes\LarkMidTable\larkmidtable-ui\node_modules\har-schema\lib\index.js:18:10)
npm ERR! at Module._compile (node:internal/modules/cjs/loader:1126:14)
npm ERR! at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
npm ERR! at Module.load (node:internal/modules/cjs/loader:1004:32)
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\gs850\AppData\Local\npm-cache\_logs\2022-10-23T07_42_13_092Z-debug-0.log
版本问题
升级 "node-sass": "^v7.0.3",对应本地node版本 16
然后更新版本 npm update --verbose
然后 重新编译,通过了
npm install --verbose
总结: 主要是升级版本,科学上网也帮助了一些吧.