1.下载官方laravel
composer create-project --prefer-dist laravel/laravel blog
2.安装 cnpm
cnpm install
platform unsupported laravel-mix@4.0.12 ? chokidar@2.0.4 ? fsevents@^1.2.2 Package require os(darwin) not compatible with your platform(win32)
[fsevents@^1.2.2] optional install error: Package require os(darwin) not compatible with your platform(win32)
√ Installed 11 packages
√ Linked 758 latest versions
√ Run 0 scripts
Recently updated (since 2018-12-21): 19 packages (detail see file D:\phpstudy\PHPTutorial\WWW\lara_vue\node_modules\.recently_updates.txt)
Today:
→ laravel-mix@4.0.12 ? autoprefixer@9.4.3 ? caniuse-lite@^1.0.30000921(1.0.30000925) (11:32:38)
→ laravel-mix@4.0.12 ? babel-loader@8.0.4 ? webpack@4.28.2 ? terser-webpack-plugin@1.2.1 ? serialize-javascript@^1.4.0(1.6.1) (15:34:50)
→ laravel-mix@4.0.12 ? webpack-cli@3.1.2 ? interpret@^1.1.0(1.2.0) (10:56:08)
√ All packages installed (849 packages installed from npm registry, used 59s(network 58s), speed 319.35kB/s, json 769(1.52MB), tarball 16.66MB)
报错: error: Package require os(darwin) not compatible with your platform(win32)
cnpm rebuild node-sass
3 运行cnpm
cnpm run dev
npm run watch 进行监听,一旦组件被修改后可以自动进行重新编译。
4 然后在 resources\views\welcome.blade.php文件 ,将其修改为下面的代码
<!doctype html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>Laravel</title>
<!-- Fonts -->
{{--<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">--}}
</head>
<body>
<div id="app">
<example-component></example-component>
</div>
</body>
<script src="js/app.js"></script>
</html>