Unable to install BigCommerce Stencil CLI with NPM

781 views Asked by At

I'm trying to install the BigCommerce Stencil Cli using NPM. I followed the instructions on the bigcommerce website but when I try to install the Stencil CLI I get errors.

I'm not experienced with NPM, all I want to do it add a style.css file to a bigcommerce theme and they are forcing you to use NPM. Clearly it isn't working for me. Can anyone help me before the voices in my head win, and i put my laptop in the dishwasher.

NPM VERSION:

{
  npm: '8.10.0',
  node: '14.19.3',
  v8: '8.4.371.23-node.87',
  uv: '1.42.0',
  zlib: '1.2.11',
  brotli: '1.0.9',
  ares: '1.18.1',
  modules: '83',
  nghttp2: '1.42.0',
  napi: '8',
  llhttp: '2.1.4',
  openssl: '1.1.1o',
  cldr: '40.0',
  icu: '70.1',
  tz: '2021a3',
  unicode: '14.0'
}

Log from an attempted stencil-cli install:


michaelcalland@Michaels-MBP-2 ~ % npm install -g @bigcommerce/stencil-cli  
npm ERR! code 1
npm ERR! git dep preparation failed
npm ERR! command /Users/michaelcalland/.nvm/versions/node/v14.19.3/bin/node /Users/michaelcalland/.nvm/versions/node/v14.19.3/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/Users/michaelcalland/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm ERR! code 1
npm ERR! npm ERR! path /Users/michaelcalland/.npm/_cacache/tmp/git-clonemTrJwq
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command sh -c node scripts/install.js
npm ERR! npm ERR! internal/modules/cjs/loader.js:905
npm ERR! npm ERR!   throw err;
npm ERR! npm ERR!   ^
npm ERR! npm ERR! 
npm ERR! npm ERR! Error: Cannot find module 'npmconf'
npm ERR! npm ERR! Require stack:
npm ERR! npm ERR! - /Users/michaelcalland/.npm/_cacache/tmp/git-clonemTrJwq/scripts/install.js
npm ERR! npm ERR!     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
npm ERR! npm ERR!     at Function.Module._load (internal/modules/cjs/loader.js:746:27)
npm ERR! npm ERR!     at Module.require (internal/modules/cjs/loader.js:974:19)
npm ERR! npm ERR!     at require (internal/modules/cjs/helpers.js:101:18)
npm ERR! npm ERR!     at Object.<anonymous> (/Users/michaelcalland/.npm/_cacache/tmp/git-clonemTrJwq/scripts/install.js:8:15)
npm ERR! npm ERR!     at Module._compile (internal/modules/cjs/loader.js:1085:14)
npm ERR! npm ERR!     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
npm ERR! npm ERR!     at Module.load (internal/modules/cjs/loader.js:950:32)
npm ERR! npm ERR!     at Function.Module._load (internal/modules/cjs/loader.js:790:12)
npm ERR! npm ERR!     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12) {
npm ERR! npm ERR!   code: 'MODULE_NOT_FOUND',
npm ERR! npm ERR!   requireStack: [
npm ERR! npm ERR!     '/Users/michaelcalland/.npm/_cacache/tmp/git-clonemTrJwq/scripts/install.js'
npm ERR! npm ERR!   ]
npm ERR! npm ERR! }
npm ERR! 
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR!     /Users/michaelcalland/.npm/_logs/2022-05-23T15_04_52_632Z-debug-0.log

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/michaelcalland/.npm/_logs/2022-05-23T15_04_48_251Z-debug-0.log

I've tried to uninstall/install npm but I don't really understand what to do here.

2

There are 2 answers

1
codeguy On

I solved this on Mac by using Node v14.20 as advised in the documentation but switching from NPM v7 to NPM v6, this is not mentioned in the documentation.

Assuming you have NVM installed, I did the following:

nvm install 14.20
nvm use 14.20
npm install -g [email protected] (or the last v6)
npm install -g @bigcommerce/stencil-cli

This now successfuly installs.

2
Yahya Fati On

I also faced the same problem but found this. You just have to use node version 14.20.0.