continuedev / continue

⏩ Continue is the leading open-source AI code assistant. You can connect any models and any context to build custom autocomplete and chat experiences inside VS Code and JetBrains
https://docs.continue.dev/
Apache License 2.0
17.85k stars 1.39k forks source link

Failure in install-all-dependencies Task Due to Non-execution of npm run build Command #812

Closed LangLangBart closed 8 months ago

LangLangBart commented 8 months ago

Before submitting your bug report

Relevant environment info

- OS: macOS
- Continue: v0.9.46
- IDE: VSCode

Description

When a user clones the repository and follows the instructions from the contributing.md file, they will encounter a failure when executing the install-all-dependencies task.

This issue can be traced back to the changes in the prepackage.js file with commit: 0419da7568670505706d1711859e714b00a8e2b5.

--- a/extensions/vscode/scripts/prepackage.js
+++ b/extensions/vscode/scripts/prepackage.js
@@ -33,7 +33,9 @@ if (args[2] === "--target") {
   execSync("npm install");
   console.log("npm install in gui completed");

-  execSync("npm run build");
+  if (ghAction()) {
+    execSync("npm run build");
+  }

   // Copy over the dist folder to the Intellij extension //
   const intellijExtensionWebviewPath = path.join(

The problem arises when the npm run build command does not execute, preventing the creation of the dist folder, which in turn causes the script to fail.

https://github.com/continuedev/continue/blob/76fe78a1a3c05b0d6dd5ed6d15575e20e797cfa6/extensions/vscode/scripts/prepackage.js#L56-L67

Failure message below:

> continue@0.9.47 prepackage
> node scripts/prepackage.js

[info] Packaging extension for target  undefined
[info] npm install in extensions/vscode completed
[info] npm install in gui completed
[error] Error copying React app build to Intellij extension:  [
  [Error: ENOENT: no such file or directory, lstat '/Users/paria/Developer/continue/gui/dist'] {
    errno: -2,
    code: 'ENOENT',
    syscall: 'lstat',
    path: '/Users/paria/Developer/continue/gui/dist'
  }
]
node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "[object Array]".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

Node.js v21.1.0

Even if the dist folder exists but is empty, the script will fail later due to these lines:

https://github.com/continuedev/continue/blob/76fe78a1a3c05b0d6dd5ed6d15575e20e797cfa6/extensions/vscode/scripts/prepackage.js#L87-L92


quick and dirty solution

Revert commit 0419da7, but only for the prepackage.js file.

To reproduce

  1. Git clone this repo
  2. Run the task install-all-dependencies
  3. Notice it fails

Log output

No response

sestinj commented 8 months ago

@LangLangBart I solved here by adding npm run build to the install-all-dependencies task.

the reason this should be okay is that the gui in development now depends on npm run dev instead of the actual built assets (index.js, index.css) (this means that we now have hot module reloading)

LangLangBart commented 8 months ago

this means that we now have hot module reloading

Wunderbar.