nrwl / nx

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

Cannot find module 'nx/src/config/configuration' #10764

Closed theTechGoose closed 2 years ago

theTechGoose commented 2 years ago

Current Behavior

I am trying to build a typescript library in my mono repo called 'crm-sdk', it fails to build with the below error

when I try an build nx build it shows the following error:

Cannot find module 'nx/src/config/configuration' Require stack:

Expected Behavior

Steps to Reproduce

run nx build

Failure Logs

Environment

NX Report complete - copy this into the issue template

Node : 17.7.1 OS : darwin arm64 yarn : 1.22.17

nx : 14.1.7 @nrwl/angular : 14.1.7 @nrwl/cypress : 14.1.7 @nrwl/detox : Not Found @nrwl/devkit : 14.1.7 @nrwl/eslint-plugin-nx : 14.1.7 @nrwl/express : Not Found @nrwl/jest : 14.1.7 @nrwl/js : 14.2.4 @nrwl/linter : 14.1.7 @nrwl/nest : Not Found @nrwl/next : Not Found @nrwl/node : 14.3.5 @nrwl/nx-cloud : 14.0.5 @nrwl/nx-plugin : Not Found @nrwl/react : Not Found @nrwl/react-native : Not Found @nrwl/schematics : Not Found @nrwl/storybook : 14.1.7 @nrwl/web : Not Found @nrwl/workspace : 14.1.7 typescript : 4.6.4 rxjs : 7.4.0

Community plugins: ngx-spinner: 13.1.1

theTechGoose commented 2 years ago

as a work around, If I run npm i @nrwl/js --save-dev it works for a while before reverting

AgentEnder commented 2 years ago

Hey @Rofer11607, some of your @nrwl/* packages don't line up with the version of nx you have installed. Aside from @nrwl/nx-cloud, all packages under the nrwl scope should generally be set up with the same version.

Can you correct this and check that the issue still reproduces? An easy way to fix this would be to run nx migrate {v}, where v is the version of nx you have installed. Alternatively, updating to latest with nx migrate latest would also work.

joewIST commented 2 years ago

Having the same issue in @nrwl/devkit. I have just run nx migrate latest

node_modules/@nrwl/devkit/index.d.ts:18:43 - error TS2724: '"nx/src/config/workspace-json-project-json"' has no exported member named 'ProjectsConfigurations'. Did you mean 'ProjectConfiguration'?

18 export type { WorkspaceJsonConfiguration, ProjectsConfigurations, TargetDependencyConfig, TargetConfiguration, ProjectConfiguration, ProjectType, Workspace, } from 'nx/src/config/workspace-json-project-json';


node_modules/@nrwl/devkit/index.d.ts:27:77 - error TS2307: Cannot find module 'nx/src/config/configuration' or its corresponding type declarations.

27 export { readNxJson, readAllWorkspaceConfiguration, workspaceLayout, } from 'nx/src/config/configuration';

node_modules/@nrwl/devkit/index.d.ts:176:44 - error TS2307: Cannot find module 'nx/src/utils/workspace-root' or its corresponding type declarations.

176 export { workspaceRoot, appRootPath } from 'nx/src/utils/workspace-root';



Found 3 errors in the same file, starting at: node_modules/@nrwl/devkit/index.d.ts:18
AgentEnder commented 2 years ago

@joewIST, this looks like its a similar issue. Output of nx report?

github-actions[bot] commented 2 years 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! 🙏

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.