BigCommerce Mogul主题npm install报错排查求助
BigCommerce Mogul主题npm install报错排查求助
问题背景
已查阅StackOverflow上关于fatal: destination path already exists and is not an empty directory.的各类解答,均不符合当前场景。
当前操作:使用BigCommerce Stencil CLI更新因SASS更新损坏的Mogul主题,默认主题cornerstone执行一切正常,仅该Mogul主题报错。
初始报错信息
执行npm install初期正常,随后抛出错误:
npm ERR! code 128 npm ERR! An unknown git error occurred npm ERR! command git --no-replace-objects clone -b v3.5.0 ssh://git@github.com/bigcommerce-labs/node-sass.git C:\Users\{user}\AppData\Local\npm-cache\_cacache\tmp\git-cloneqNjHIQ --recurse-submodules --depth=1 --config core.longpaths=true npm ERR! fatal: destination path 'C:\Users\{user}\AppData\Local\npm-cache\_cacache\tmp\git-cloneqNjHIQ' already exists and is not an empty directory. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\{user}\AppData\Local\npm-cache\_logs\2024-02-08T19_02_35_223Z-debug-0.log
已尝试操作
- 执行
npm install期间监控报错提到的临时目录,发现会被自动删除,手动删除后重新执行仍报错 - 日志仅包含命令行输出,无额外诊断信息
- 联系BigCommerce支持,仅收到无关的git和npm文档链接
- 执行
npm cache clean --force,无效
环境信息:Windows 11,Node.js 18.15.0(BigCommerce指定版本),npm 9.5.0
更新1:更换缓存目录后的报错
尝试使用npm install --cache C:\npm-cache更换缓存目录,仍报相同错误,仅缓存路径变更:
npm notice npm notice New major version of npm available! 9.5.0 -> 10.4.0 npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.4.0 npm notice Run npm install -g npm@10.4.0 to update! npm notice npm ERR! code 128 npm ERR! An unknown git error occurred npm ERR! command git --no-replace-objects clone -b v3.5.0 ssh://git@github.com/bigcommerce-labs/node-sass.git C:\npm-cache\_cacache\tmp\git-cloneai3aNq --recurse-submodules --depth=1 --config core.longpaths=true npm ERR! fatal: destination path 'C:\npm-cache\_cacache\tmp\git-cloneai3aNq' already exists and is not an empty directory. npm ERR! A complete log of this run can be found in: npm ERR! C:\npm-cache\_logs\2024-02-08T19_28_36_867Z-debug-0.log
更新2:切换git协议为https后的新错误
将git协议从ssh切换为https后,出现新的404及克隆错误:
npm ERR! Cannot download "https://github.com/bigcommerce-labs/node-sass/releases/download/v3.5.0/win32-x64-108_binding.node": npm ERR! npm ERR! HTTP error 404 Not Found npm ERR! npm ERR! Hint: If github.com is not accessible in your location npm ERR! try setting a proxy via HTTP_PROXY, e.g. npm ERR! npm ERR! export HTTP_PROXY=http://example.com:1234 npm ERR! npm ERR! or configure npm proxy via npm ERR! npm ERR! npm config set proxy http://example.com:8080 npm ERR! Cloning into './src/libsass'... npm ERR! fetch-pack: unexpected disconnect while reading sideband packet npm ERR! fatal: early EOF npm ERR! fatal: fetch-pack: invalid index-pack output npm ERR! npm ERR! npm ERR! code 1 npm ERR! npm ERR! path C:\Users\{user}\AppData\Local\npm-cache\_cacache\tmp\git-cloneCGVfvR npm ERR! npm ERR! command failed npm ERR! npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/build.js
附:主题package.json内容
{ "name": "bigcommerce-mogul", "description": "Mogul theme for the Stencil platform", "version": "2.7.0", "private": true, "author": "BigCommerce", "dependencies": { "@babel/polyfill": "^7.4.4", "@bigcommerce/stencil-utils": "^6.11.0", "@tholman/intense-images": "^1.0.3", "bc-baseline": "github:bigcommerce/themes-lib-baseline", "bc-carousel": "github:bigcommerce/themes-lib-carousel", "bc-compare": "github:bigcommerce/themes-lib-compare", "bc-loading": "github:bigcommerce/themes-lib-loading", "bc-modal": "github:bigcommerce/themes-lib-modal", "bc-scroll-link": "github:bigcommerce/themes-lib-scroll-link", "bc-tabs": "github:bigcommerce/themes-lib-tabs", "creditcards": "^4.2.0", "eventemitter2": "^5.0.1", "fitvids": "^2.0.0", "flickity": "^2.0.5", "flickity-bg-lazyload": "^1.0.0", "flickity-imagesloaded": "^2.0.0", "flickity-sync": "^2.0.0", "history.js": "github:browserstate/history.js", "jquery": "^3.5.1", "jquery-revealer": "github:bigcommerce/themes-lib-jquery.revealer", "jquery-trend": "github:bigcommerce/themes-lib-jquery.trend", "just-debounce": "^1.0.0", "lazysizes": "5.3.2", "normalize.scss": "^0.1.0", "object-fit-images": "^3.2.4", "path": "^0.12.7", "validetta": "github:bigcommerce/themes-lib-validetta", "whatwg-fetch": "^3.4.0" }, "devDependencies": { "@babel/core": "^7.4.5", "@babel/plugin-syntax-dynamic-import": "^7.2.0", "@babel/preset-env": "^7.2.0", "@bigcommerce/citadel": "^2.15.1", "@bigcommerce/stencil-cli": "^2.1.1", "async": "^2.6.4", "babel-loader": "^8.0.4", "babel-plugin-lodash": "^3.3.2", "babel-plugin-transform-object-rest-spread": "^6.23.0", "babel-preset-es2015": "^6.18.0", "clean-webpack-plugin": "^0.1.19", "core-js": "^3.6.5", "es6-shim": "^0.35.1", "lodash-webpack-plugin": "^0.11.2", "shelljs": "^0.8.5", "webpack": "~4.27.1", "webpack-bundle-analyzer": "^3.0.3", "webpack-cli": "~3.3.12", "webpack-merge": "~4.1.2", "@babel/plugin-proposal-object-rest-spread": "^7.2.0" }, "main": "stencil.conf.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "license": "ISC" }
寻求技术解决方案。
内容的提问来源于stack exchange,提问作者tvirelli
相关产品推荐
相关产品推荐

