I have looked at many other answers to the question about the 'fatal: destination path already exists and is not an empty directory.' here on StackOverflow. None of them seem to be what is going on with me.

I am trying to update a theme that is now broken on BigCommerce due to a SASS update. I'm using BigCommerce Stencil CLI. To be clear, I can download and do everything I need to for their default theme "cornerstone" and I have no issues. It's only with this specific theme I am getting an error.

When I run npm install everything starts working fine, then it stops and errors out with the following error:

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

I've checked and even watched that folder during npm install, that folder gets removed and even when I delete it manually, I still get this error. If I check the log, it's just the output that shows in the command line and ends with this error and no extra info.

I've contacted BigCommerce about it, but they just keep sending me random links about git and npm that have nothing to do with my issue.

For more info, the theme in question is 'Mogul'. I'm on Windows 11. My node version is 18.15.0 which is what BigCommerce requires we use. My npm version is 9.5.0.

I've tried npm cache clean --force and that doesn't work.

I'm kind of at a total loss on what is going on and I wonder if it's something simple that I'm just missing.

Any and all help is greatly appreciated.

UPDATE: I just tried to run the command with npm install --cache C:\npm-cache to 100% verify there wasn't already something in the directory and I still get the same error, but now with the new cache location:

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

UPDATE 2: I read about trying to switch from git: to https: and tried that. Now I am getting the follow error. Does this mean its a problem with the repo?

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

As requested 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"
}
1

There are 1 best solutions below

0
On

Thanks for adding the package.json contents! I see several potential issues in there:

  1. "@bigcommerce/stencil-cli": "^2.1.1", should be deleted. There is no reason to have this included in this file. This alone might resolve the issue.
  2. "@bigcommerce/stencil-utils": "^6.11.0", should be upgraded to 6.15.1 for a number of reasons.
  3. I have run into issues trying to install packages that are in the format beginning with github:. Not sure if those can be replaced with actual version numbers.
  4. You may also need to update the webpack items. Though this would require also updating the webpack config files. You can reference Cornerstone's package.json file for which versions are current.