withastro / astro

The web framework for content-driven websites. ⭐️ Star to support our work!
https://astro.build
Other
46.8k stars 2.49k forks source link

Cannot read properties of undefined (reading 'getScriptFileNames') #11763

Closed adxdits closed 2 months ago

adxdits commented 2 months ago

Astro Info

VSCODE
21:51:24 [types] Generated 87ms
21:51:24 [check] Getting diagnostics for Astro files in C:\Users\adama\Desktop\adamalmounayarblog.github.io...
Cannot read properties of undefined (reading 'getScriptFileNames')
  Stack trace:
    at AstroCheck.lint (C:\Users\adama\Desktop\adamalmounayarblog.github.io\node_modules\@astrojs\language-server\dist\check.js:59:84)
    at async check (file:///C:/Users/adama/Desktop/adamalmounayarblog.github.io/node_modules/@astrojs/check/dist/index.js:95:24)
    at async runCommand (file:///C:/Users/adama/Desktop/adamalmounayarblog.github.io/node_modules/astro/dist/cli/index.js:153:27)

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Description: I encountered an issue while trying to build my Astro project using the npm build command. The build process fails with the following error message:

What's the expected result?

SUCCESS BUILD

Link to Minimal Reproducible Example

..

Participation

AdrianButler commented 2 months ago

I am also getting the same issue after updating astro dependencies and now I keep getting the issue even after downgrading to old version

killoblanco commented 2 months ago

I'm not getting it on local. I'm getting once I've deployed to cloudflare pages tho.

RyanHarrigan commented 2 months ago

I'm also getting this error

"astro": "^4.14.2",
"@astrojs/check": "^0.9.2",

also looks like @astrojs/language-server@^2.13.2 uses:

"@volar/kit" "~2.4.0-alpha.15"

EDIT: Reverting to "@astrojs/check": "^0.7.0", works

envmar commented 2 months ago

Same errors on a fresh Astro + DB install, same script versions. Running "npm run build".

I wasn't getting it on an existing local project.

adxdits commented 2 months ago

Proposed Solution I fixed the issue by modifying the package.json file. Just delete the checking from the build. Specifically, I replaced the check and build scripts with a simplified build script. The removal of the check script resolved the issue. It appears that there might be a problem with the astro check command or its interaction with the current project setup. The updated package.json file looks like this: { "name": "dimensional-disk", "type": "module", "version": "0.0.1", "scripts": { "dev": "astro dev", "start": "astro dev", "build": " astro build", "preview": "astro preview", "astro": "astro" }, "dependencies": { "astro": "^4.14.2", "@astrojs/check": "^0.9.2", "typescript": "^5.5.4" } }

Princesseuh commented 2 months ago

Let's do the discussion in https://github.com/withastro/language-tools/issues/939