本文介绍了安装stencil-cli和基本主题时出现错误"stencil init"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试按照文档中的说明安装stencil-cli和base主题.使用节点版本管理器并将其更改为版本4.6.1后,我成功安装了stencil-cli,但是在克隆主题并运行npm install之后,尝试运行stencil init后出现以下错误:
I'm trying to install the stencil-cli and base theme following the instructions in the documentation. I successfully installed stencil-cli after I used a node version manager and changed it to version 4.6.1, but after cloning the theme and running npm install I get the following error after trying to run stencil init:
$ stencil init
module.js:327
throw err;
^
Error: Cannot find module 'C:\Users\dannytaki\AppData\Roaming\npm\node_modules\@bigcommerce\stencil-cli\bin\stencil'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:974:3
推荐答案
我不确定100%确定哪个步骤可以解决此问题,但这是我所做的:
I'm not 100% sure which step resolved this issue, but here is what I did:
- 卸载了我的NVM(节点版本管理器)和现有的Node安装.删除现有的npm安装位置(例如"C:\ Users \ AppData \ Roaming \ npm"),以便正确使用nvm安装位置.
- 重新安装了我的NVM管理器
https://github.com/coreybutler/nvm-windows
,并使用nvm install 4.6.1 64
获取模具所需的节点的正确版本,然后运行nvm use 4.6.1
. - 进入控制面板并更新了我的视觉工作室,以包括
Common Tools
组件. - 然后,按照模具文档中详细介绍的正常步骤进行操作.
-
npm install -g @bigcommerce/stencil-cli
-
git clone https://github.com/bigcommerce/stencil.git
-
cd stencil
-
npm install
-
stencil init
- uninstalled both my NVM (node version manager) and the existing installation of Node. Deleted the existing npm install location (e.g. "C:\Users\AppData\Roaming\npm") so that the nvm install location will be correctly used instead.
- Reinstalled my NVM manger
https://github.com/coreybutler/nvm-windows
and usenvm install 4.6.1 64
to get the correct version of node required for stencil, and rannvm use 4.6.1
. - Went into control panel and updated my visual studios to include the
Common Tools
component. - Then, ran through the normal progression of steps as detailed in the stencil documentation.
npm install -g @bigcommerce/stencil-cli
git clone https://github.com/bigcommerce/stencil.git
cd stencil
npm install
stencil init
这篇关于安装stencil-cli和基本主题时出现错误"stencil init"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!