You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I go to build the projects files with pnpm dev or pnpm build I run into this error. Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'C:\Users\tfine\OneDrive\Documents\projects\chakra-ui\packages\utils\C:\Users\tfine\OneDrive\Documents\projects\chakra-ui\packages\utils\package.json' imported from C:\Users\tfine\OneDrive\Documents\projects\chakra-ui\scripts\build\main.ts
For some reason the path is doubling up and causing the build to crash. In scripts/build/main.ts the code causing the error appears to be
I just dont know why resolve would be causing the issue. cwd for me shows up as a normal path but it gets wonky when put into resolve. Running latest version of node on windows 11.
It appears there is a couple of issues building the project on windows. There is a resolve function imported from node:path/posix that is messing up the path for windows. Switching that to node:path instead fixed that but caused another error. It seems there is an issue using await import() on a package.json so I had to switch to using const packageJson = JSON.parse( await readFile(resolve(process.cwd(), "package.json"), "utf-8"), )to load the package json and also had to change the resolve to join in getBasePath. Since making those changes I can now build the project.
Tfines19
changed the title
Unable to build project [ERR_MODULE_NOT_FOUND]
Unable to build project on windows [ERR_MODULE_NOT_FOUND]
Apr 30, 2024
Description
When I go to build the projects files with pnpm dev or pnpm build I run into this error.
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'C:\Users\tfine\OneDrive\Documents\projects\chakra-ui\packages\utils\C:\Users\tfine\OneDrive\Documents\projects\chakra-ui\packages\utils\package.json' imported from C:\Users\tfine\OneDrive\Documents\projects\chakra-ui\scripts\build\main.ts
For some reason the path is doubling up and causing the build to crash. In scripts/build/main.ts the code causing the error appears to be
const cwd = process.cwd();
const packageJson = await import(resolve(cwd, "package.json"))
I just dont know why resolve would be causing the issue. cwd for me shows up as a normal path but it gets wonky when put into resolve. Running latest version of node on windows 11.
Link to Reproduction
https://codesandbox.io
Steps to reproduce
Chakra UI Version
2.0.0
Browser
No response
Operating System
Additional Information
No response
The text was updated successfully, but these errors were encountered: