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

'Cannot find module' error in Typescript project on windows #164

Closed
yanivNaor92 opened this issue Mar 2, 2020 · 3 comments · Fixed by #165
Closed

'Cannot find module' error in Typescript project on windows #164

yanivNaor92 opened this issue Mar 2, 2020 · 3 comments · Fixed by #165
Labels
Milestone

Comments

@yanivNaor92
Copy link

I have a typescript project that uses "yeoman-environment" dependency (version 2.8.0).
When I try to run the project's tests with 'npm run test' I receive the following error: "Error: Cannot find module 'C:\Users<User><project_name>\src\app\index.js' ".
This error appears on windows platform but not on Mac.
After I downgrade to v2.7.0 the project runs fine.
The index.ts file exists (C:\Users<User><project_name>\src\app\index.ts) in the project, as well as a mapping to the index.js file

After investigation I found that the following code was added to 'environment.js' file on v2.8.0 (lines 693-697):
let resolved; // Win32: moduleId is resolving as moduleId.js or moduleId.json instead of moduleId/index.js, workaround it. if (process.platform === 'win32' && path.extname(moduleId) === '') { resolved = require.resolve(path.join(moduleId, 'index.js')); }

I think that might be the cause of the problem.

A link to the repository: https://github.wdf.sap.corp/devx-wing/generator-ui-5-simple

@mshima
Copy link
Member

mshima commented Mar 2, 2020

@yanivNaor92 the repository is not accessible, but I think it's not required.
Can you confirm if mshima/environment#fix_164 fixes your issue?

@yanivNaor92
Copy link
Author

Thank you, mshima/environment#fix_164 does fixed the issue. When is the next release supposed to be?

@mshima
Copy link
Member

mshima commented Mar 5, 2020

@SBoudrias is responsible for releases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants