v2.9.1: Cannot find module 'colors'
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' ]
}
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?
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 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.