I m getting strange issu…

2 minute read

I’m getting strange issues from a node app. I’ve created a new app. Inside the main.ts file I’m importing libs I’ve created in the workspace. I get module not found for all of the modules. IDE autocompletes for me, the modules build and run tests individually, I even see the dependency graph correctly. When I build the app - it cannot find the modules. Any idea why this might happen?


Ok - my bad. Leaving my shame here if anyone stumbles into this - need to build/serve with the flag --with-deps in order for it to build the libs

It is still happening. Any idea why when I do nx serve my-project it does not find libs I import?

I’m 95% sure the problem is somewhere in your tsconfig files. Make sure that the project level tsconfig.json is correctly extending the workspace root tsconfig.json

And make sure that the serve builder is using the correct tsconfig.json

I’ll take a look - but this is a new app, with nothing custom - just used: nx g @nrwl/node:app

hm.. can you reproduce in a separate repository?

That’s my http://ts.config.app|ts.config.app: { "extends": "./tsconfig.json", "compilerOptions": { "outDir": "../../dist/out-tsc", "types": ["node"] }, "exclude": ["**/*.spec.ts"], "include": ["**/*.ts"] }

if you can reproduce it, you should file an issue so we can track it down

It never happened to me before

Just suddenly happened - so don’t think this can be reproduced easily

Another strange thing that’s happening is the following:

When I’m using --with-deps it builds the deps, but it sometimes fails that some libs internal file is missing

Might this be because I’m using .js files?

you could try adding "allowJs": true to the compilerOptions of the tsconfig.json for any project that uses .js files

Nx does this for you if you run nx g @nrwl/node:lib some-name --js


Same result :disappointed: I get this message in the console if it helps: main.js was not restarted.

I would make a new repo and try to recreate this behavior

Just to rule out step by step what is not causing the problem

And then if you reproduce it, we can really help

Ok - I’ll try. Thanks!

it happens in a new workspace as well

With no js files at all


Maybe it is the Mac or the nodejs version?

Not sure, but it’s worth filing an issue.

thanks for making a reproduction

I’m trying the same repo on a different laptop

Ok - it reproduced in 4 different laptops :disappointed: Here’s the issue: https://github.com/nrwl/nx/issues/3074

i replied to your issue