Vite不工作
Os:CentOs7Laravel:9.26.1节点:v16.17.0npm:8.15.0
我想在React.js中使用新的Laravel项目。并尝试验证的插件Breeze
我使用命令
composer create-project laravel/laravel new-project
php artisan breeze:install
php artisan breeze:install react
npm install
npm run dev
起初所有命令都成功完成,但当我使用时
npm run dev
服务器告诉我
/tmp/dev-xxxxxx.sh: line 1: vite: command not found
我试着解决这个问题https://github.com/vitejs/vite/discussions/5432
以及https://github.com/vitejs/vite/issues/1215
这对我来说都不管用
这是包.json
{
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"@headlessui/react": "^1.4.2",
"@inertiajs/inertia": "^0.11.0",
"@inertiajs/inertia-react": "^0.8.0",
"@inertiajs/progress": "^0.2.6",
"@tailwindcss/forms": "^0.5.2",
"@vitejs/plugin-react": "^2.0.0",
"alpinejs": "^3.4.2",
"autoprefixer": "^10.4.2",
"axios": "^0.27",
"laravel-vite-plugin": "^0.5.0",
"lodash": "^4.17.19",
"postcss": "^8.4.6",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"tailwindcss": "^3.1.0"
},
"dependencies": {
"vite": "^3.0.9"
}
}
我应该如何解决这个问题
我找到了问题我在npm安装之前键入
npm config set bin-links false
因为CentOs7有符号链接错误(bin链接到我的笔记本电脑(无法安装完整的
所以我应该将bin链接设置为true和npm安装vite
这将解决的问题