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

本地部署jQuery官网及解决grunt deploy报错等问题求助

本地部署jQuery官网问题解决方案

一、解决grunt deploy报错ReferenceError: primordials is not defined

这个错误是旧版Grunt(0.4.x)与Node.js 12+版本不兼容导致的,两种解决方式如下:

方式1:切换Node.js到兼容版本

  • 安装nvm(Node版本管理器),终端执行:
    nvm install 10
    nvm use 10
    
  • 进入contribute.jquery.org目录,删除node_modules文件夹,重新执行:
    npm install
    grunt deploy
    

方式2:锁定graceful-fs依赖版本

  • 在contribute.jquery.org目录下创建npm-shrinkwrap.json文件,内容如下:
    {
      "dependencies": {
        "graceful-fs": {
          "version": "4.2.2"
        }
      }
    }
    
  • 删除node_modules文件夹,重新执行npm install,之后再运行grunt deploy即可。

二、关联jquery.com仓库到本地vagrant.jquery.com站点

  1. 确保jquery-wp-content和下载好的jquery.com仓库在同一目录层级(比如都放在E:\下)。
  2. 进入jquery-wp-content目录,执行构建并部署命令:
    grunt build:jquery.com
    grunt deploy:jquery.com
    
  3. 若手动关联,可在jquery-wp-content/sites目录下创建符号链接:
    • Windows系统:
      mklink /D jquery.com ..\jquery.com
      
    • Linux/macOS系统:
      ln -s ../jquery.com sites/jquery.com
      
  4. 访问http://vagrant.jquery.com即可查看内容。

三、添加jqueryui.com仓库实现本地无网访问

1. 修复跳转协议问题

  • 打开本地WordPress后台(http://vagrant.jquery.com/wp-admin),找到jQueryUI导航链接,将https://vagrant.jqueryui.com修改为http://vagrant.jqueryui.com;也可直接在jquery-wp-content/themes/jquery目录的配置/模板文件中查找替换该链接。

2. 关联并部署jqueryui.com内容

  1. 将下载好的jqueryui.com仓库放在与jquery-wp-content同级的目录下。
  2. 进入jquery-wp-content目录,执行构建和部署命令:
    grunt build:jqueryui.com
    grunt deploy:jqueryui.com
    
  3. 若需手动关联,在jquery-wp-content/sites目录下创建符号链接指向../jqueryui.com(命令参考上文符号链接步骤)。
  4. 访问http://vagrant.jqueryui.com即可查看jQueryUI文档内容。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.24 21:18:16