Troubleshooting 'npm install' Error in Bigcommerce Theme Directory on Windows PC

201 Views Asked by At

System Information:

  • Node.js version: 20.5.0
  • npm version: 9.8.1
  • Chocolatey version: 2.2.0
  • Git version: 2.41.0.windows.3

Issue Encountered: When trying to run "npm install" in my Bigcommerce theme directory (C:\Website\Stencil for website\Fortune+31072023-2.8.0) on my Windows PC, I encountered the following error:

npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command C:\Program Files\Git\bin\git.exe --no-replace-objects clone -b v3.5.0 ssh://[email protected]/bigcommerce-labs/node-sass.git C:\Users\saman\AppData\Roaming\npm-cache\_cacache\tmp\git-clonerVR5QJ --recurse-submodules --depth=1 --config core.longpaths=true
npm ERR! fatal: destination path 'C:\Users\saman\AppData\Roaming\npm-cache\_cacache\tmp\git-clonerVR5QJ' already exists and is not an empty directory.

Troubleshooting Steps Performed:

  • Tried different versions of Node.js.
  • Restarted all the installation steps.
  • Deleted all path variables related to Node.js and reinstalled it.
  • Checked Git configuration (user name and email).
  • Cleared npm cache using "npm cache clean --force."
  • Set the remote URL for node-sass to HTTPS using "npm config set node-sass:git https://github.com/bigcommerce-labs/node-sass.git."
  • Updated npm globally using "npm install -g npm."
  • Manually verified and deleted the supposed cache directory ("C:\Users\saman\AppData\Roaming\npm-cache_cacache\tmp").

Additional Information:

Using Windows operating system. The directory "C:\Users\saman\AppData\Roaming\npm-cache_cacache\tmp" is empty, and it has never existed before. The goal is to execute "npm install" successfully in the Bigcommerce theme directory to use Stencil-CLI and edit the theme.

Summary:

How can I resolve the error I encountered during "npm install" when trying to execute the command in my Bigcommerce theme directory on my Windows PC? The specified destination path mentioned in the error ("C:\Users\saman\AppData\Roaming\npm-cache_cacache\tmp") is empty. I have tried several troubleshooting steps, but the issue persists. My goal is to use Stencil-CLI and edit my Bigcommerce theme. What should I do to successfully execute "npm install"?

Log:

6377 timing idealTree Completed in 64623ms
6378 timing command:install Completed in 64627ms
6379 verbose stack Error: An unknown git error occurred
6379 verbose stack     at makeError (C:\Users\saman\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\git\lib\make-error.js:28:13)
6379 verbose stack     at C:\Users\saman\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\git\lib\spawn.js:37:26
6379 verbose stack     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
6379 verbose stack     at async C:\Users\saman\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\lib\git.js:268:19
6379 verbose stack     at async withTempDir (C:\Users\saman\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\fs\lib\with-temp-dir.js:21:14)
6379 verbose stack     at async Promise.all (index 3)
6379 verbose stack     at async #buildDepStep (C:\Users\saman\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1034:5)
6379 verbose stack     at async Arborist.buildIdealTree (C:\Users\saman\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:196:7)
6379 verbose stack     at async Promise.all (index 1)
6379 verbose stack     at async Arborist.reify (C:\Users\saman\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:159:5)
6380 verbose cwd C:\Website\Stencil for website\Fortune+31072023-2.8.0
6381 verbose Windows_NT 10.0.22621
6382 verbose node v20.5.0
6383 verbose npm  v9.8.1
6384 error code 128
6385 error An unknown git error occurred
6386 error command C:\Program Files\Git\bin\git.exe --no-replace-objects clone -b v3.5.0 ssh://[email protected]/bigcommerce-labs/node-sass.git C:\Users\saman\AppData\Roaming\npm-cache\_cacache\tmp\git-clonerVR5QJ --recurse-submodules --depth=1 --config core.longpaths=true
6387 error fatal: destination path 'C:\Users\saman\AppData\Roaming\npm-cache\_cacache\tmp\git-clonerVR5QJ' already exists and is not an empty directory.
6388 verbose exit 128
6389 timing npm Completed in 64795ms
6390 verbose unfinished npm timer reify 1690972639361
6391 verbose unfinished npm timer reify:loadTrees 1690972639363
6392 verbose code 128
1

There are 1 best solutions below

1
On

I was getting the same error on my Macbook, but upgrading these packages resolved the issue.

from:

"@bigcommerce/stencil-utils": "^5.0.3"
"@bigcommerce/stencil-cli": "^2.1.1"

to

"@bigcommerce/stencil-utils": "^6.15.1"
"@bigcommerce/stencil-cli": "^7.2.0"