You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Vue CLI项目遇Windows Script Host报错:Microsoft JScript编译错误(第1469行)

Fixing Windows Script Host JScript Compilation Error (Line 1469) After Vue CLI Project Creation

Hey there, I’ve run into this exact error a few times when working with Vue CLI on Windows, so let’s break down how to fix it. That Microsoft JScript compilation error is almost always tied to misconfigured script handlers or environment conflicts between Node.js and Windows. Here’s what you can try:

  • Verify Node.js and Vue CLI versions
    First, make sure you’re running a stable LTS version of Node.js—preview or outdated builds often clash with Windows’ script environment. Open your terminal and run these commands to check:

    node -v
    vue --version
    

    If your Node.js version is outdated, grab the latest LTS build, then reinstall Vue CLI globally to ensure compatibility:

    npm uninstall -g @vue/cli
    npm install -g @vue/cli
    
  • Fix Windows .js file association
    The most common culprit here is Windows trying to run .js files with its own JScript engine instead of Node.js. To correct this:

    1. Open Command Prompt as Administrator.
    2. Run this command (replace the Node.js path with your actual installation location if it differs):
      ftype NodeJSFile="C:\Program Files\nodejs\node.exe" "%1" %*
      
    3. Set the file association to use Node.js for .js files:
      assoc .js=NodeJSFile
      

    Restart your terminal after this, then try running npm run serve again.

  • Clean npm cache and reinstall dependencies
    Corrupted cache or node modules can trigger weird script errors too. Do the following in your project directory:

    1. Delete the node_modules folder and package-lock.json file.
    2. Clear the npm cache:
      npm cache clean --force
      
    3. Reinstall fresh dependencies:
      npm install
      
  • Switch to PowerShell
    Sometimes Command Prompt has environment variable quirks that cause this issue. Try using PowerShell (run as Administrator) to create your Vue project or start the dev server—this often bypasses the script handler conflict entirely.

  • Check project script configuration
    Double-check your project’s package.json file to ensure the scripts are correctly set up. The default serve and build commands should look like this:

    "scripts": {
      "serve": "vue-cli-service serve",
      "build": "vue-cli-service build"
    }
    

    If anything looks off, regenerate the project with Vue CLI to get fresh, default scripts.

内容的提问来源于stack exchange,提问作者KNIGHT MAHAJAN

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 04:06:44