首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在正式文档中安装laravel?

如何在正式文档中安装laravel?
EN

Stack Overflow用户
提问于 2022-10-06 20:00:44
回答 1查看 159关注 0票数 0

我似乎不能仅仅使事情与jetstream一起工作。我已经使用livewire和惰性选项安装了,在尝试npm构建npm运行构建时,我不断地得到关于vite的错误。

代码语言:javascript
复制
> build
> vite build

failed to load config from **APP_ROOT**\\vite.config.js
error during build:
TypeError: import_laravel_vite_plugin.refreshPaths is not iterable
    at Object.<anonymous> (**APP_ROOT**\\vite.config.js:41:39)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object._require.extensions.<computed> [as .js] (file:///F:/PROJECTS/HUGE/CoreRahisify/rahisify-core-gateway-api/node_modules/vite/dist/node/chunks/dep-db16f19c.js:63524:24)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
    at Module.require (node:internal/modules/cjs/loader:1028:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at loadConfigFromBundledFile (file:///F:/PROJECTS/HUGE/CoreRahisify/rahisify-core-gateway-api/node_modules/vite/dist/node/chunks/dep-db16f19c.js:63532:21)
    at loadConfigFromFile (file:///F:/PROJECTS/HUGE/CoreRahisify/rahisify-core-gateway-api/node_modules/vite/dist/node/chunks/dep-db16f19c.js:63400:34)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

经过几次尝试,我甚至连npm安装都没有错误,因为我得到了以下错误:

代码语言:javascript
复制
npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: laravel-vite-plugin@0.2.4        
npm ERR! Found: vite@3.1.6
npm ERR! node_modules/vite
npm ERR!   dev vite@"^3.1.6" from the root project
npm ERR!   peer vite@"^3.0.0" from @vitejs/plugin-vue@3.1.2
npm ERR!   node_modules/@vitejs/plugin-vue
npm ERR!     dev @vitejs/plugin-vue@"^3.0.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer vite@"^2.9.9" from laravel-vite-plugin@0.2.4
npm ERR! node_modules/laravel-vite-plugin
npm ERR!   dev laravel-vite-plugin@"^0.2.1" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: vite@2.9.15
npm ERR! node_modules/vite
npm ERR!   peer vite@"^2.9.9" from laravel-vite-plugin@0.2.4
npm ERR!   node_modules/laravel-vite-plugin
npm ERR!     dev laravel-vite-plugin@"^0.2.1" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See C:\Users\Warren Arnold\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Warren Arnold\AppData\Local\npm-cache\_logs\2022-10-06T19_47_43_871Z-debug-0.log

以下是我的vite.config:

代码语言:javascript
复制
import { defineConfig } from 'vite';
import laravel, { refreshPaths } from 'laravel-vite-plugin';

export default defineConfig({
    plugins: [
        laravel({
            input: [
                'resources/css/app.css',
                'resources/js/app.js',
            ],
            refresh: [
                ...refreshPaths,
                'app/Http/Livewire/**',
            ],
        }),
    ],
});

以下是我的package.json

代码语言:javascript
复制
{
    "private": true,
    "scripts": {
        "dev": "vite",
        "build": "vite build",
        "test": "jest",
        "jest": "jest --coverage"
    },
    "devDependencies": {
        "@babel/preset-typescript": "^7.18.6",
        "@inertiajs/inertia": "^0.11.0",
        "@inertiajs/inertia-vue3": "^0.6.0",
        "@inertiajs/progress": "^0.2.7",
        "@tailwindcss/forms": "^0.5.2",
        "@tailwindcss/typography": "^0.5.0",
        "@types/express-list-endpoints": "^6.0.0",
        "@types/jest": "^29.0.0",
        "@vitejs/plugin-vue": "^3.0.0",
        "alpinejs": "^3.0.6",
        "autoprefixer": "^10.4.7",
        "axios": "^0.25",
        "date-fns": "^2.28.0",
        "express": "^4.18.1",
        "laravel-vite-plugin": "^0.2.1",
        "lodash": "^4.17.19",
        "postcss": "^8.4.14",
        "save-dev": "^0.0.1-security",
        "tailwindcss": "^3.1.0",
        "ts-jest": "^28.0.8",
        "ts-node": "^10.9.1",
        "typescript": "^4.7.4",
        "vite": "^3.1.6",
        "vue": "^3.2.31"
    },
    "dependencies": {
        "@babel/preset-env": "^7.18.10",
        "@types/express": "^4.17.13",
        "@types/morgan": "^1.9.3",
        "@types/node-fetch": "^2.6.2",
        "babel-jest": "^28.1.3",
        "caller-id": "^0.1.0",
        "dotenv": "^16.0.2",
        "express-list-endpoints": "^6.0.0",
        "jest": "^28.1.3",
        "morgan": "^1.10.0",
        "node-fetch": "^2.6.7",
        "nodemon": "^2.0.19",
        "nyc": "^15.1.0",
        "pg": "^8.8.0",
        "sequelize": "^6.21.4"
    }
}

我在节点16.17,拉拉9.19。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-10-10 22:35:38

这个错误似乎源于这样一个事实: laravel使用vite 2,而当前的vite是3,但是jetstream只是安装最新的依赖项,而没有考虑到这一点。因此,您必须手动尝试的版本,发挥良好的彼此。目前对我起作用的是:

代码语言:javascript
复制
    "@vitejs/plugin-vue": "^2.3.3",
    "laravel-vite-plugin": "^0.2.1",
    "vite": "^2.9.11",
    "vue": "^3.2.31"
    "tailwindcss": "^3.1.0",

看来laravel-vite-pluginlaravel-vite-plugin依赖关系中最冲突的。

要进行更改,您可以编辑package.json并运行npm或npm安装特定的包,指定版本get安装,链接从npm获得正确的格式。

这使我耽搁了好几个小时。问题甚至不像我在16.17上回答的那样是关于节点的,不过也要检查一下,升级节点最终会遇到更多关于openssl的问题,因为我安装了postgres,这增加了path中的配置。我不想碰那个。在烦躁不安地创建单独的项目和分别安装微风之后,我发现了错误。

经过几个小时的互联网搜索后,我每天从拉拉维尔的普维拉斯( Povilas )那里得到一个关于这个推特发生了什么的提示。

这个问题与我的问题相似,如果我没有错的话:

看看这个

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73979439

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档