I get this error upon running newly created JHelloWorld.js:

Cannot find module 'storefront_controllers/cartridge/scripts/guard'

I created this controller under training cartridge and following controller guide .

  • Just an FYI, you don't actually run the JS for Commerce Cloud B2C locally. It is only intended to be executed on the hosted instances.
    – sholsinger
    Apr 17, 2019 at 4:08

2 Answers 2


replace storefront_controllers with Training_controllers

var guard = require('Training_controllers/cartridge/scripts/guard');

resolved by putting locale address to require('c/users/.....) guard.js script

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.