Error 'stencil init' when installing stencil-cli and base theme

十年热恋 提交于 2019-12-11 08:39:30

问题


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:

  1. 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.
  2. Reinstalled my NVM manger https://github.com/coreybutler/nvm-windows and use nvm install 4.6.1 64 to get the correct version of node required for stencil, and ran nvm use 4.6.1.
  3. Went into control panel and updated my visual studios to include the Common Tools component.
  4. Then, ran through the normal progression of steps as detailed in the stencil documentation.
  5. npm install -g @bigcommerce/stencil-cli
  6. git clone https://github.com/bigcommerce/stencil.git
  7. cd stencil
  8. npm install
  9. stencil init


来源:https://stackoverflow.com/questions/42421408/error-stencil-init-when-installing-stencil-cli-and-base-theme

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!