stencil-cli icon indicating copy to clipboard operation
stencil-cli copied to clipboard

Stencil start gives stencil-cli out of date error

Open AnirudhSingal91 opened this issue 3 years ago • 35 comments

I'm trying to serve my cornerstone theme locally. I have the latest version of stencil-cli installed (v3.5.0). Im getting the error "not ok -- Error: Error: You are using an outdated version of stencil-cli, please run $ npm install -g @bigcommerce/stencil-cli"

ive tried reinstalling stencil-cli but it didnt help.

Expected behavior

Expected behaviour is upon running strencil start, my stencil theme should start getting served localy.

Actual behavior

I get error "not ok -- Error: Error: You are using an outdated version of stencil-cli, please run $ npm install -g @bigcommerce/stencil-cli"

Steps to reproduce behavior

run stencil start

AnirudhSingal91 avatar Sep 15 '21 21:09 AnirudhSingal91

Please install 3.5.1.

zvuki avatar Sep 15 '21 22:09 zvuki

Please install 3.5.1.

it gives the error "not ok -- Error: Could not fetch a list of the store channels: Request failed with status code 404" now

AnirudhSingal91 avatar Sep 15 '21 22:09 AnirudhSingal91

More context here: https://developer.bigcommerce.com/changelog#publications/required-stencil-cli-version-set-to-3-5-0

bookernath avatar Sep 15 '21 22:09 bookernath

@AnirudhSingal91 if you're still seeing the issue on 3.5.1, can you try regenerating your CLI token from the control panel? Sorry for the inconvenience.

bookernath avatar Sep 15 '21 22:09 bookernath

@AnirudhSingal91 if you're still seeing the issue on 3.5.1, can you try regenerating your CLI token from the control panel? Sorry for the inconvenience.

I regenerated the token. im still getting the error "not ok -- Error: Could not fetch a list of the store channels: Request failed with status code 404"

AnirudhSingal91 avatar Sep 15 '21 22:09 AnirudhSingal91

@AnirudhSingal91 I'm getting the same exact error on [email protected] after updating and using new tokens:

not ok -- Error: Could not fetch a list of the store channels: Request failed with status code 403

r742davis avatar Sep 16 '21 15:09 r742davis

It is silly that you FORCE AN UPDATE every time you release a minor version or point release. This has killed half my day (and seems to every time you decide to push a new version).

steve-ross avatar Sep 16 '21 17:09 steve-ross

My team is seeing the same thing as @AnirudhSingal91 and @r724davis. We have tried updating, uninstalling and reinstalling with no luck. Does anyone have a solution or work around?

zpaquette avatar Sep 16 '21 17:09 zpaquette

@zpaquette try updating your API key to include read access on store channels

steve-ross avatar Sep 16 '21 18:09 steve-ross

@zpaquette try updating your API key to include read access on store channels

How does that work? Aren't stencil CLI token and API keys completely independent of each other?

AnirudhSingal91 avatar Sep 16 '21 18:09 AnirudhSingal91

Please install 3.5.1.

To be clear, attempting to resolve this issue led me directly into this concurrent issue: https://github.com/bigcommerce/stencil-cli/issues/768

I had to spend the better part of today trying to figure out what versions of node, npm and stencil-cli work together with no clear guidance from any of the output from stencil-cli. Why was this a forced update, especially with it not working on the latest npm in node 12?

rossyoung5 avatar Sep 16 '21 20:09 rossyoung5

I will mention for myself:

Ran into the outdated stencil cli error.

After uninstalling stencil-cli, globally and then installing it again globally on version 3.5.1, it still wasn't working via npm run start.

However,

running stencil init again and then stencil start seems to work fine for now. Not the greatest experience but at least I can get it running for the interim again.

MattPua avatar Sep 16 '21 21:09 MattPua

Having the same issue. Was working just fine yesterday. Tried uninstalling the CLI and reinstalling but get an error like Cannot find module 'mkdirp' :/

I'm on Node v12.22.1

Update: The workaround mentioned in #768 worked for me 👍

drmzio avatar Sep 17 '21 02:09 drmzio

ye, me too ,fk bc

HATECORO avatar Sep 17 '21 07:09 HATECORO

I updated BC,then let me update node ,fk ,wst my time .

HATECORO avatar Sep 17 '21 07:09 HATECORO

This is still not working and it looks like im going to miss an important deadline because of this issue. I still get the error "not ok -- Error: Could not fetch a list of the store channels: Request failed with status code 404".

Any help will be appreciated!

AnirudhSingal91 avatar Sep 17 '21 13:09 AnirudhSingal91

@AnirudhSingal91 Have you tried @steve-ross's workaround in #768 ?

Workaround for NPM 7.x

npm i -g npm@6
npm i -g @bigcommerce/stencil-cli
npm i -g npm@latest

rossyoung5 avatar Sep 17 '21 14:09 rossyoung5

@rossyoung5 Yes. didnt work.

AnirudhSingal91 avatar Sep 17 '21 14:09 AnirudhSingal91

@AnirudhSingal91 Have you tried @steve-ross's workaround in #768 ?

Workaround for NPM 7.x

npm i -g npm@6
npm i -g @bigcommerce/stencil-cli
npm i -g npm@latest

I opened this one ;)

steve-ross avatar Sep 17 '21 14:09 steve-ross

@steve-ross Yes did so. No help. I end up getting the same error code as before.

AnirudhSingal91 avatar Sep 17 '21 14:09 AnirudhSingal91

@AnirudhSingal91 you can try doing a cache clean after you downgrade to npm@6 with npm cache clean --force

May help to post some more info about your environment. ie: windows / Mac , node version, npm version, etc

steve-ross avatar Sep 17 '21 14:09 steve-ross

@steve-ross Windows 10 node 12.0.0 npm 6.9.0 stencil-cli 3.5.1

AnirudhSingal91 avatar Sep 17 '21 14:09 AnirudhSingal91

You may also want to reinit stencil... I had to do that even though my project was on 3.5.0 OR ensure you have an apiHost in your config.stencil.json

ex:

{
  "customLayouts": {
    "brand": {},
    "category": {},
    "page": {},
    "product": {}
  },
  "apiHost": "https://api.bigcommerce.com",
  "normalStoreUrl": "https://somewhere.mybigcommerce.com/",
  "port": 3000
}

steve-ross avatar Sep 17 '21 14:09 steve-ross

@AnirudhSingal91 @rossyoung5 @HATECORO @drmzio So I was able to get Stencil-CLI to work after doing the following:

  1. Obtained from store owner new API credentials with full read/write access for every endpoint
  2. Ran npm i -g @bigcommerce/stencil-cli to upgrade to version @3.5.1
  3. Re-ran stencil init which adds an additional key to the config.stencil.json file: "apiHost": "https://api.bigcommerce.com",
  4. Ran stencil start and store was able to run locally

Environment:

npm version: 6.14.12 node version: v12.22.1 Works for at least Cornerstone 2.5.1+

Recommendation for Future Releases:

  • When additional keys are added to stencil.config.json please make sure to mention that this was added and that it requires re-initializing stencil in the terminal
  • If this version requires new API tokens, please tell us this is the case - Don't assume we can read minds or have time to spend half the day troubleshooting something that worked fine the day before. We just want to know what's going on :)

r742davis avatar Sep 17 '21 14:09 r742davis

@r742davis I was just typing something like this up... BigC shouldn't introduce breaking changes in point releases. DEFAULT YOUR DAMN VARIABLES!

const apiHost = config.apiHost || 'https://api.bigcommerce.com';

steve-ross avatar Sep 17 '21 14:09 steve-ross

omg @steve-ross @r742davis!! it worked. idk what worked exactly. but it worked. Most probably it was the apiHost that was getting set incorrectly.

AnirudhSingal91 avatar Sep 17 '21 14:09 AnirudhSingal91

yeah, I think is a bug in stencil-cli that is defaulting the apiHost variable to the store url instead of the actual api endpoint

steve-ross avatar Sep 17 '21 14:09 steve-ross

@steve-ross ive been having another issue with stencil bundle command. i get the error "Error: Cannot find module 'babel-plugin-dynamic-import-webpack'". do you have any idea about it?

AnirudhSingal91 avatar Sep 17 '21 14:09 AnirudhSingal91

nope but it looks like your project is missing that package... npm i -D babel-plugin-dynamic-import-webpack then retry

steve-ross avatar Sep 17 '21 14:09 steve-ross

@steve-ross I tried that. It leads me to Error: Cannot find module 'babel-plugin-transform-regenerator'

when i do npm i -D babel-plugin-transform-regenerator, it leads me to

Error: Cannot find module 'babel-preset-env'

when i do npm i -D babel-preset-env, it leads me to

ERROR in ./assets/js/app.js Module build failed (from ./node_modules/babel-loader/lib/index.js):

AnirudhSingal91 avatar Sep 17 '21 15:09 AnirudhSingal91