quickest-silver
quickest-silver7mo ago

Failed npm run build with lots of errors:

Failed npm run build with lots of errors:
18 Replies
kapa.ai
kapa.ai7mo ago
Hi @lukevo. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- I'm sorry, but I can't provide a solution without more specific details about the errors you're encountering. The errors could be due to a variety of reasons such as missing dependencies, incorrect configuration, or incompatible versions of packages. Please make sure you've installed all necessary packages and that your configuration files are set up correctly. If you're still having trouble, you might find it helpful to check the official Refine documentation (https://refine.dev/docs) or the Refine GitHub issues page (https://github.com/refinedev/refine/issues) for similar problems and their solutions. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai7mo ago
<@582491401715974144> kapa.ai is still learning and improving, please let us know how it did by reacting below
quickest-silver
quickest-silver7mo ago
I have attached the file @kapa.ai
kapa.ai
kapa.ai7mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- I'm sorry, but as an AI, I'm unable to access or view attached files. However, I can help you troubleshoot based on the error messages or issues you describe. Please provide more details about the errors you're encountering during the build process. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai7mo ago
<@582491401715974144> kapa.ai is still learning and improving, please let us know how it did by reacting below
quickest-silver
quickest-silver7mo ago
These are some of the errors: import { useResource } from "@hooks/resource"; ~~~ node_modules/@refinedev/core/src/hooks/invalidate/index.tsx:9:34 - error TS2307: Cannot find module '@definitions' or its corresponding type declarations. 9 import { pickDataProvider } from "@definitions"; ~~ node_modules/@refinedev/core/src/hooks/invalidate/index.tsx:11:25 - error TS2307: Cannot find module '@hooks/useKeys' or its corresponding type declarations. 11 import { useKeys } from "@hooks/useKeys"; ~~~~ node_modules/@refinedev/core/src/hooks/legacy-router/useRouterContext.ts:2:48 - error TS2307: Cannot find module '@contexts/legacy-router' or its corresponding type declarations. 2 import { RouterContext, defaultProvider } from "@contexts/legacy-router"; ~~~~~ node_modules/@refinedev/core/src/hooks/live/useLiveMode/index.ts:3:31 - error TS2307: Cannot find module '@contexts/refine' or its corresponding type declarations. 3 import { RefineContext } from "@contexts/refine"; ~~~~ node_modules/@refinedev/core/src/hooks/live/usePublish/index.ts:3:29 - error TS2307: Cannot find module '@contexts/live' or its corresponding type declarations. 3 import { LiveContext } from "@contexts/live"; ~~~~ @kapa.ai
kapa.ai
kapa.ai7mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- The errors you're encountering seem to be related to missing modules or incorrect import paths in your project. Here are a few steps you can take to troubleshoot: 1. Check your import paths: Make sure that the paths you're using to import modules are correct. For example, the error Cannot find module '@hooks/useKeys' suggests that the module useKeys cannot be found at the specified path. Make sure that the file exists and the path is correct. 2. Install missing dependencies: If certain modules are missing from your node_modules directory, you might need to install them. You can do this by running npm install in your project directory. 3. Check your TypeScript configuration: If you're using TypeScript, make sure your tsconfig.json file is correctly set up. You might need to adjust your compilerOptions to correctly resolve modules. If you're still encountering issues, you might find it helpful to check the official Refine documentation (https://refine.dev/docs) or the Refine GitHub issues page (https://github.com/refinedev/refine/issues) for similar problems and their solutions. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai7mo ago
<@582491401715974144> kapa.ai is still learning and improving, please let us know how it did by reacting below
quickest-silver
quickest-silver7mo ago
This is my tsconfig @kapa.ai { "compilerOptions": { "target": "ESNext", "useDefineForClassFields": true, "lib": ["DOM", "DOM.Iterable", "ESNext"], "allowJs": false, "skipLibCheck": true, "esModuleInterop": false, "allowSyntheticDefaultImports": true, "strict": true, "forceConsistentCasingInFileNames": true, "module": "ESNext", "moduleResolution": "Node", "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, "jsx": "react-jsx", "baseUrl": "./src", "paths": { "@/": ["./"] } }, "include": ["src", "vite.config.ts"], "references": [{ "path": "./tsconfig.node.json" }] }
kapa.ai
kapa.ai7mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- Your tsconfig.json file seems to be correctly set up for a typical TypeScript project. However, the errors you're encountering suggest that the paths for certain modules can't be resolved. One potential issue could be with the paths option in your tsconfig.json file. You've set "@/*": ["./*"] which means that TypeScript will look for modules starting with @/ in the same directory as the tsconfig.json file. If your modules are located elsewhere, you'll need to adjust this path. For example, if your modules are located in a src directory, you might need to change your paths option to:
"paths": {
"@/*": ["./src/*"]
}
"paths": {
"@/*": ["./src/*"]
}
This tells TypeScript to look for @/ imports in the src directory. Also, ensure that the baseUrl is correctly set. The baseUrl is a directory that TypeScript uses to resolve non-relative module names. In your case, it's set to ./src, which means TypeScript will use the src directory as a starting point for module resolution. If you're still encountering issues, you might find it helpful to check the official Refine documentation (https://refine.dev/docs) or the Refine GitHub issues page (https://github.com/refinedev/refine/issues) for similar problems and their solutions. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai7mo ago
<@582491401715974144> kapa.ai is still learning and improving, please let us know how it did by reacting below
secure-lavender
secure-lavender7mo ago
@lukevo This looks like an issue with your imports, can you check if all your imports from refine packages are appropriate and doesnt import things from /dist/… etc. ?
quickest-silver
quickest-silver7mo ago
@aliemir confirmed, no idea what's going on
No description
quickest-silver
quickest-silver7mo ago
Everything related to @hooks
quickest-silver
quickest-silver7mo ago
Found it @refinedev/core/config.json: { "include": ["src", "types"], "extends": "../../tsconfig.build.json", "compilerOptions": { "rootDir": "./src", "baseUrl": ".", "importHelpers": false, "paths": { "@components/": ["src/components/"], "@components": ["src/components"], "@containers/": ["src/containers/"], "@containers": ["src/containers"], "@pages/": ["src/pages/"], "@pages": ["src/pages"], "@contexts/": ["src/contexts/"], "@contexts": ["src/contexts"], "@dataProviders/": ["src/dataProviders/"], "@dataProviders": ["src/dataProviders"], "@hooks/": ["src/hooks/"], "@hooks": ["src/hooks"], "@test/": ["test/"], "@test": ["test"], "@definitions/": ["src/definitions/"], "@definitions": ["src/definitions"] }, "typeRoots": ["./types", "../../node_modules/@types"] } } Cannot read file 'd:/dental-crm-beta/node_modules/tsconfig.build.json'.ts JSON schema for the TypeScript compiler's configuration file This is problematic: "extends": "../../tsconfig.build.json",