nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.63k stars 2.36k forks source link

nx-ignore on Vercel: Cannot find module 'nx/presets/core.json' #11791

Closed mikestecker closed 1 year ago

mikestecker commented 2 years ago

Current Behavior

When attempting to use the nx-ignore command with Vercel, I see this error in the build logs: Error: Cannot find module 'nx/presets/core.json'

Full error:

14:13:04.778 | Running "npx nx-ignore rvillage-web"
14:13:15.782 | ≫ Using Nx to determine if this project (rvillage-web) is affected by the commit...
14:13:15.931 | Error: Cannot find module 'nx/presets/core.json'
14:13:15.931 | Require stack:
14:13:15.931 | - /vercel/.npm/_npx/254/lib/node_modules/nx-ignore/node_modules/nx/src/config/workspaces.js
14:13:15.931 | - /vercel/.npm/_npx/254/lib/node_modules/nx-ignore/node_modules/nx/src/project-graph/file-utils.js
14:13:15.932 | - /vercel/.npm/_npx/254/lib/node_modules/nx-ignore/node_modules/nx/src/command-line/affected.js
14:13:15.932 | - /vercel/.npm/_npx/254/lib/node_modules/nx-ignore/src/index.js
14:13:15.932 | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
14:13:15.932 | at Function.resolve (internal/modules/cjs/helpers.js:107:19)
14:13:15.932 | at Workspaces.readNxJson (/vercel/.npm/_npx/254/lib/node_modules/nx-ignore/node_modules/nx/src/config/workspaces.js:152:52)
14:13:15.932 | at readNxJson (/vercel/.npm/_npx/254/lib/node_modules/nx-ignore/node_modules/nx/src/config/configuration.js:7:72)
14:13:15.932 | at /vercel/.npm/_npx/254/lib/node_modules/nx-ignore/node_modules/nx/src/command-line/affected.js:20:55
14:13:15.932 | at Generator.next (<anonymous>)
14:13:15.932 | at /vercel/.npm/_npx/254/lib/node_modules/nx-ignore/node_modules/tslib/tslib.js:118:75
14:13:15.932 | at new Promise (<anonymous>)
14:13:15.933 | at Object.__awaiter (/vercel/.npm/_npx/254/lib/node_modules/nx-ignore/node_modules/tslib/tslib.js:114:16)
14:13:15.933 | at affected (/vercel/.npm/_npx/254/lib/node_modules/nx-ignore/node_modules/nx/src/command-line/affected.js:18:20) {
14:13:15.933 | code: 'MODULE_NOT_FOUND',
14:13:15.933 | requireStack: [
14:13:15.933 | '/vercel/.npm/_npx/254/lib/node_modules/nx-ignore/node_modules/nx/src/config/workspaces.js',
14:13:15.933 | '/vercel/.npm/_npx/254/lib/node_modules/nx-ignore/node_modules/nx/src/project-graph/file-utils.js',
14:13:15.933 | '/vercel/.npm/_npx/254/lib/node_modules/nx-ignore/node_modules/nx/src/command-line/affected.js',
14:13:15.933 | '/vercel/.npm/_npx/254/lib/node_modules/nx-ignore/src/index.js'
14:13:15.933 | ]
14:13:15.933 | }

Expected Behavior

Shouldn't see this error

Steps to Reproduce

This is the first time trying to use this feature. Simply followed instructions from https://nx.dev/recipe/deploy-nextjs-to-vercel#skipping-build-if-the-application-is-not-affected

Failure Logs

See above

Environment

 >  NX   Report complete - copy this into the issue template

   Node : 16.14.0
   OS   : darwin arm64
   yarn : 1.22.19

   nx : 14.5.2
   @nrwl/angular : Not Found
   @nrwl/cypress : 14.5.2
   @nrwl/detox : 14.5.2
   @nrwl/devkit : 14.5.2
   @nrwl/eslint-plugin-nx : 14.5.2
   @nrwl/express : Not Found
   @nrwl/jest : 14.5.2
   @nrwl/js : 14.5.2
   @nrwl/linter : 14.5.2
   @nrwl/nest : Not Found
   @nrwl/next : 14.5.2
   @nrwl/node : 14.5.2
   @nrwl/nx-cloud : 14.3.0
   @nrwl/nx-plugin : Not Found
   @nrwl/react : 14.5.2
   @nrwl/react-native : 14.5.2
   @nrwl/schematics : Not Found
   @nrwl/storybook : 14.5.2
   @nrwl/web : 14.5.2
   @nrwl/workspace : 14.5.2
   typescript : 4.7.4
   ---------------------------------------
   Community plugins:
     @nx-tools/nx-prisma: 3.0.1
     ngx-deploy-npm: 3.1.9

(node:28504) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at /Users/mikestecker/Development/roadpass-nx/node_modules/tslib/package.json.
Update this package.json to use a subpath pattern like "./*".
(Use `node --trace-deprecation ...` to show where the warning was created)
✨  Done in 0.64s.
github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏

AgentEnder commented 1 year ago

This should be fixed, I'm going to close it out. If its not, can you open an issue on nrwl/nx-labs?

github-actions[bot] commented 1 year ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.