问题
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
回答1:
I'm not 100% sure which step resolved this issue, but here is what I did:
- 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
来源:https://stackoverflow.com/questions/42421408/error-stencil-init-when-installing-stencil-cli-and-base-theme