【问题标题】:Unable to install BigCommerce Stencil CLI with NPM无法使用 NPM 安装 BigCommerce Stencil CLI
【发布时间】:2022-10-14 19:48:00
【问题描述】:

我正在尝试使用 NPM 安装 BigCommerce Stencil Cli。我按照bigcommerce 网站上的说明进行操作,但是当我尝试安装 Stencil CLI 时出现错误。

我对 NPM 没有经验,我想做的只是将 style.css 文件添加到 bigcommerce 主题中,他们强迫您使用 NPM。显然它对我不起作用。在我脑海中的声音获胜之前,谁能帮助我,我把笔记本电脑放在洗碗机里。

NPM 版本:

{
  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'
}

从尝试的 stencil-cli 安装记录:


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

我试图卸载/安装 npm,但我真的不明白在这里做什么。

【问题讨论】:

    标签: node.js npm npm-install bigcommerce-stencil-cli


    【解决方案1】:

    我也遇到了同样的问题,但找到了this。您只需要使用节点版本 14.20.0。

    【讨论】: