sfcc-ci icon indicating copy to clipboard operation
sfcc-ci copied to clipboard

v2.9.1: Cannot find module 'colors'

Open EvilJordan opened this issue 4 years ago • 3 comments

After successful install via: npm install -g:

[12:51:31] eviljordan@shruggy ../dev/sfra/sfcc-ci $ sfcc-ci -V
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'colors'
Require stack:
- /Users/eviljordan/dev/sfra/sfcc-ci/cli.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/eviljordan/dev/sfra/sfcc-ci/cli.js:8:14)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/Users/eviljordan/dev/sfra/sfcc-ci/cli.js' ]
}

EvilJordan avatar Feb 09 '22 17:02 EvilJordan

hi @EvilJordan , tried to reproduce this:

$ git clone [email protected]:SalesforceCommerceCloud/sfcc-ci.git issue-290
$ cd issue-290
$ npm install -g
added 223 packages from 196 contributors in 6.79s
$ sfcc-ci -V
2.9.1

which succeeds here. Any detailed info you share to reproduce this?

tobiaslohr avatar Feb 10 '22 12:02 tobiaslohr

Hmmm, I am now getting respectable build results by doing the following:

$ git clone [email protected]:SalesforceCommerceCloud/sfcc-ci.git
$ cd sfcc-ci
$ sudo npm install # this appears to be necessary so snyk can run

However, which sfcc-ci is pointing to /opt/local/bin/sfcc-ci, which in turn is a symlink to: sfcc-ci@ -> ../lib/node_modules/sfcc-ci/cli.js which in turn is: sfcc-ci@ -> ../../../../Users/eviljordan/dev/sfra/sfcc-ci (the directory where everything was just built).

Running sfcc-ci -V outputs 2.7.2, and I'm not sure why...

EvilJordan avatar Feb 11 '22 21:02 EvilJordan

@EvilJordan thanks! That seems to explain, why the error is thrown as it's using an older CLI version. Were you able to check, why it is using the older version although you just cloned from the repo using the default branch master? You can double check, by cd into the directory you just cloned into and then run

$ ./cli.js -V

If which sfcc-ci is pointing to an older version, you can also try running npm link in the fresh clone.

tobiaslohr avatar Feb 15 '22 10:02 tobiaslohr