首页 > 解决方案 > Laravel Jetstream 安装 Bootstrap 和 Jquery

问题描述

我已经在我的 Laravel 8 项目中安装了 Jetstream 和 Livewire。但我不知道如何将 JQuery 和 Bootstrap 包含到我的项目中。我怎样才能做到这一点?

编辑: Bootstrap 部分已理解,但仍无法安装 Jquery。

查询部分

正如@codedge 所说,我试图npm require jquery在我的项目文件夹和其他地方运行命令,它给了我这个输出:

Usage: npm <command>

where <command> is one of:
    access, adduser, audit, bin, bugs, c, cache, ci, cit,
    clean-install, clean-install-test, completion, config,
    create, ddp, dedupe, deprecate, dist-tag, docs, doctor,
    edit, explore, fund, get, help, help-search, hook, i, init,
    install, install-ci-test, install-test, it, link, list, ln,
    login, logout, ls, org, outdated, owner, pack, ping, prefix,
    profile, prune, publish, rb, rebuild, repo, restart, root,
    run, run-script, s, se, search, set, shrinkwrap, star,
    stars, start, stop, t, team, test, token, tst, un,
    uninstall, unpublish, unstar, up, update, v, version, view,
    whoami

npm <command> -h  quick help on <command>
npm -l            display full usage info
npm help <term>   search for help on <term>
npm help npm      involved overview

Specify configs in the ini-formatted file:
    C:\Users\YARKIN\.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

npm@6.14.10 D:\nodejs\node_modules\npm

Did you mean this?
    rebuild

EDIT-2:我无法将 Jquery 添加到我的 public\js\app.js 中,尽管我已经安装并需要它 resources\js\app.js。

标签: phplaraveltwitter-bootstrapjetstream

解决方案


Jetstream 不支持 Bootstrap 和 jQuery - 这是有意为之,如本Github 问题中所述。

有一个包可以为 Jetstream 带来对 Bootstrap 的支持:https ://github.com/nascent-africa/jetstrap

jQuery 可以通过npm install jquery和安装required在你的app.js.


推荐阅读