我已经查看了有关“致命:目标路径已经存在并且不是空目录”问题的许多其他答案。在 StackOverflow 上。他们似乎都不是我身上发生的事情。
我正在尝试更新由于 SASS 更新而在 BigCommerce 上损坏的主题。我正在使用 BigCommerce Stencil CLI。需要明确的是,我可以下载并执行其默认主题“基石”所需的一切,并且没有任何问题。只有这个特定主题我才会收到错误。
当我运行
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://[email protected]/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 的随机链接,这些链接与我的问题无关。
有关更多信息,相关主题是“Mogul”。我使用的是 Windows 11。我的节点版本是 18.15.0,这是 BigCommerce 要求我们使用的版本。我的 npm 版本是 9.5.0.
我已经尝试过
npm cache clean --force
,但不起作用。
我对正在发生的事情完全不知所措,我想知道这是否是我错过的简单事情。
非常感谢任何和所有帮助。
更新: 我只是尝试使用
npm install --cache C:\npm-cache
运行命令以 100% 验证目录中尚不存在某些内容,但我仍然遇到相同的错误,但现在有了新的缓存位置:
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 [email protected] 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://[email protected]/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: 的信息,并尝试了这一点。现在我收到以下错误。这是否意味着回购有问题?
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"
}
感谢您添加 package.json 内容!我在那里看到了几个潜在的问题:
"@bigcommerce/stencil-cli": "^2.1.1",
应删除。没有理由将其包含在此文件中。仅此一点可能解决问题。"@bigcommerce/stencil-utils": "^6.11.0",
应升级为 6.15.1
。github:
开头的格式的软件包时遇到了问题。不确定这些是否可以替换为实际版本号。