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

"yarn build" is not working correctly on Windows #1558

Open
JaroslawLegierski opened this issue Dec 4, 2023 · 15 comments
Open

"yarn build" is not working correctly on Windows #1558

JaroslawLegierski opened this issue Dec 4, 2023 · 15 comments
Labels
bug Dysfunctionnal behavior build / ci All about Build or Continious Integration help wanted Any help from community is wanted

Comments

@JaroslawLegierski
Copy link
Contributor

Question

When I building project (latest master) on Windows (Windows 10 Pro 22H2) process node.exe hangs during following command execution:

[INFO] Running 'yarn build' in C:\ ..... repo\leshan\leshan-server-demo\webapp
[INFO] yarn run v1.22.19
[INFO] $ vite build --emptyOutDir
[INFO] vite v5.0.2 building for production...
[INFO] transforming...

During the Windows system trace, I noticed that node.exe was looking for a file package.json in C:\

I found temporary workaround by coping package.json from \leshan-server-demo\webapp\ to the C:\ 😉

@JaroslawLegierski JaroslawLegierski added the question Any question about leshan label Dec 4, 2023
@sbernard31
Copy link
Contributor

That sounds strange...

Probably because of : #1541

But it works well on my dev machine, on jenkins and on github action. (but this is all linux)

I haven't window machine so I can test that.
Do you also face issue when you are using a terminal in git/leshan/leshan-server-demo/webapp then run :
yarn build ? (without the workaround of course)

@JaroslawLegierski
Copy link
Contributor Author

Do you also face issue when you are using a terminal in git/leshan/leshan-server-demo/webapp then run :
yarn build ? (without the workaround of course)

When I starting yarn build in webapp directory node.exe is stopping here:

$ vite build --emptyOutDir
vite v5.0.2 building for production...
transforming (510) src\components\values\input\DateTimeValueInput.vue

@sbernard31
Copy link
Contributor

And with your workaround it works ?

@JaroslawLegierski
Copy link
Contributor Author

And with your workaround it works ?

Yes - works 😉

@sbernard31
Copy link
Contributor

In our code base, I think code about vite path resolution could be :

nodeResolve({
modulePaths: [path.resolve("./node_modules")],
}),

resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
"@leshan-server-core-demo": path.join(
__dirname,
"../../leshan-server-core-demo/webapp/src"
),
},
extensions: [".js", ".vue"],
},

Maybe you can try to investigate around this to see ?
(e.g. replacing path.resolve by path.posix.resolve OR replacing __dirname by hardcoded value OR ... )

@sbernard31
Copy link
Contributor

I check vite repository to see If there was some issue opened which could looks like to that, I didn't see anything...

But maybe you can try to get last vite version:

yarn upgrade
yarn build

@sbernard31
Copy link
Contributor

Maybe also a node bug ? but I didn't investigate this too much because I guess you don't use same node version when you did yarn build directly in webapp folder and when you run mvn clean install.

@JaroslawLegierski
Copy link
Contributor Author

Thank you for your advices. I tested all proposed above solutions but I still have this issue. I think that we have problem with passing the path (or converting it 'eg: ./ -> /) in one of the libraries used by esbuild:
esbuild2

For now, I will use the workaround and I plan to switch to other leshan tasks 😉

@sbernard31 sbernard31 added bug Dysfunctionnal behavior build / ci All about Build or Continious Integration and removed question Any question about leshan labels Dec 7, 2023
@sbernard31
Copy link
Contributor

OK too bad that we didn't succeed to solve this. 😞
Not a good news that windows user will not be able to build Leshan anymore.

Hoping that maybe another contributor will be able to investigate 🤞

@sbernard31 sbernard31 added the help wanted Any help from community is wanted label Dec 11, 2023
@JaroslawLegierski
Copy link
Contributor Author

I'm afraid that only Magda and me are using Windows in leshan development. I going to return to this issue after finish #1089

JaroslawLegierski added a commit to JaroslawLegierski/leshan that referenced this issue Dec 13, 2023
JaroslawLegierski added a commit to JaroslawLegierski/leshan that referenced this issue Dec 13, 2023
@JaroslawLegierski
Copy link
Contributor Author

After deeper investigation I found that on Windows "yarn build" command stops because node.exe is looking for file package.json in leshan-server-core-demo subdirectory. Because this file is not present in this directory node is continuing search in the every directories up to the root level (C:\).
The problem can be solved by creating the copy of package.json file in leshan-server-core-demo/webapp/.

@sbernard31
Copy link
Contributor

Thx for looking at this.

The problem can be solved by creating the copy of package.json file in leshan-server-core-demo/webapp/.

This still looks like a workaround but this is a better one.

After deeper investigation I found that on Windows "yarn build" command stops because node.exe is looking for file package.json in leshan-server-core-demo subdirectory

Why do it search that ? 🤔
I still feel this is something relative to a bad path resolution ==> #1558 (comment)

@JaroslawLegierski
Copy link
Contributor Author

I still feel this is something relative to a bad path resolution ==> #1558 (comment)

I checked the paths and they look OK:

Windows

dirname: C:\Users\Jarek\IdeaProjects\leshan_JaroslawLegierski_repo\leshan-server-demo\webapp
MAVEN_OUTPUT_DIR: undefined
outputDir: ../target/dist
@: C:\Users\Jarek\IdeaProjects\leshan_JaroslawLegierski_repo\leshan-server-demo\webapp\src
@leshan-server-core-demo: C:\Users\Jarek\IdeaProjects\leshan_JaroslawLegierski_repo\leshan-server-core-demo\webapp\src

Linux

dirname: /root/leshan/leshan-server-demo/webapp
MAVEN_OUTPUT_DIR: undefined
outputDir: ../target/dist
@: /root/leshan/leshan-server-demo/webapp/src
@leshan-server-core-demo: /root/leshan/leshan-server-core-demo/webapp/src

Why do it search that ? 🤔

It looks like the situation described in this article

@sbernard31
Copy link
Contributor

About checking path, maybe you should check for modulePaths: [path.resolve("./node_modules")], too ?

It looks like the situation described in this article

This explain how nodejs search module using require but not really why it works on linux and not on windows. I mean on Linux path resolution seems OK. 🤔

@JaroslawLegierski
Copy link
Contributor Author

I added modulePaths: [path.resolve("./node_modules")] to logs in vite.config.js

Windows
modulePaths: C:\Users\Jarek\IdeaProjects\leshan_JaroslawLegierski_repo\leshan-server-demo\webapp\node_modules

Linux
modulePaths: /root/leshan/leshan-server-demo/webapp/node_modules

in both cases paths are correct. I will ask our frontend developers if they encountered a similar problem ....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Dysfunctionnal behavior build / ci All about Build or Continious Integration help wanted Any help from community is wanted
Projects
None yet
Development

No branches or pull requests

2 participants