Error 'stencil init' when installing stenc

2019-08-02 02:50发布

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

enter image description here

enter image description here enter image description here

标签: bigcommerce
1条回答
不美不萌又怎样
2楼-- · 2019-08-02 03:39

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
查看更多
登录 后发表回答