Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Cannot find module '[...]/node_modules\node_modules\projen\bin\projen' if outdir without a subfolder in path #718

Closed
jo-koe opened this issue Mar 7, 2024 · 3 comments
Labels
bug Something isn't working needs-triage

Comments

@jo-koe
Copy link

jo-koe commented Mar 7, 2024

Describe the bug

When using awscdk.AwsCdkTypeScriptApp with an outdir without a subfolder e.g. just abc instead of subfolder/abc the below error is thrown during pdk build.

Expected Behavior

pdk build should succeed.

Current Behavior

pdk build fails with this error:

> nx run abc:build

$ D:\Users\XXX\Development\pdk-monorepo-issue\node_modules\.bin\projen build
abc: � build » post-compile » synth:silent | cdk synth -q
abc: node:internal/modules/cjs/loader:1147
abc:   throw err;
abc:   ^
abc: Error: Cannot find module 'D:\Users\XXX\Development\pdk-monorepo-issue\node_modules\node_modules\projen\bin\projen'
abc:     at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
abc:     at Module._load (node:internal/modules/cjs/loader:985:27)
abc:     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
abc:     at node:internal/main/run_main_module:28:49 {
abc:   code: 'MODULE_NOT_FOUND',
abc:   requireStack: []
abc: }
abc: Node.js v20.11.1
abc: Subprocess exited with error 1
abc: � Task "build » post-compile » synth:silent" failed when executing "cdk synth -q" (cwd: D:\Users\XXX\Development\pdk-monorepo-issue\abc)
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
abc: Warning: run-commands command "yarn projen build" exited with non-zero status code

Reproduction Steps

  1. Run `pdk new monorepo-ts``
  2. Change .projenrc.ts to the following:
import { monorepo } from "@aws/pdk";
import { awscdk  } from 'projen';
const project = new monorepo.MonorepoTsProject({
  devDeps: ["@aws/pdk"],
  name: "pdk-monorepo-issue",
  projenrcTs: true,
});

new awscdk.AwsCdkTypeScriptApp({ 
  name: 'abc',
  outdir: 'abc',
  parent: project,
  cdkVersion: '2.131.0',
  defaultReleaseBranch: 'main',
});
project.synth();
  1. Run pdk
  2. Run pdk build

Possible Solution

No response

Additional Information/Context

No response

PDK version used

0.23.11

What languages are you seeing this issue on?

Typescript

Environment details (OS name and version, etc.)

Windows Server 2019

@jo-koe jo-koe added bug Something isn't working needs-triage labels Mar 7, 2024
@cogwirrel
Copy link
Member

Hey @jo-koe,

Thanks for raising this! I've just tried your example and it seems to work for me!

I notice you're using Windows Server. Unfortunately we don't natively support Windows right now, but the recommended approach is to use WSL if you can.

We've got an issue open to add docs for this: #664

Thanks,
Jack

@jo-koe
Copy link
Author

jo-koe commented Mar 8, 2024

Hi @cogwirrel,

indeed Windows seems to be the problem here. I've switched to AMZ Linux now and it's working fine!

Cheers,
Jonas

@jo-koe jo-koe closed this as completed Mar 8, 2024
@cogwirrel
Copy link
Member

Ah great to hear it's working for you on linux! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage
Projects
None yet
Development

No branches or pull requests

2 participants