Hey everyone I m trying…

less than 1 minute read

Hey everyone. I’m trying to use nx in a docker image. I am installing @nrwl/cli when building the docker image with RUN npm i @nrwl/cli -g but when I run /usr/local/bin/nx affected:apps on circleci it errors out with (nx is found when i run the docker image locally) ```internal/modules/cjs/loader.js:797 throw err; ^

Error: Cannot find module ‘/home/circleci/project/repo/node_modules/@nrwl/cli/bin/nx.js’ Require stack:

  • /usr/local/lib/node_modules/@nrwl/cli/bin/nx.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15) at Function.Module._load (internal/modules/cjs/loader.js:687:27) at Module.require (internal/modules/cjs/loader.js:849:19) at require (internal/modules/cjs/helpers.js:74:18) at Object.<anonymous> (/usr/local/lib/node_modules/@nrwl/cli/bin/nx.js:54:9) at Module._compile (internal/modules/cjs/loader.js:956:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10) at Module.load (internal/modules/cjs/loader.js:812:32) at Function.Module._load (internal/modules/cjs/loader.js:724:14) at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10) { code: ‘MODULE_NOT_FOUND’, requireStack: [ ‘/usr/local/lib/node_modules/@nrwl/cli/bin/nx.js’ ] }``` looking at the nx.js file its using process.cwd as its base when the command is global, which is defaulting to ~/project/repo in my circle config, does anyone know how to get nx running correctly as a global package in a docker image?