Windows10 系统下 使用Laravel 5.7 操作 NPM 命令报错 ?


vagrant@homestead:~/code/laravel-shop$ yarn add vue-template-compiler --dev --production=fa                                                                                                     lse --no-bin-links
yarn add v1.7.0
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.6: The platform "linux" is incompatible with this module.
info "fsevents@1.2.6" is an optional dependency and failed compatibility check. Excluding i                                                                                                     t from installation.
[3/4] Linking dependencies...
warning " > sass-loader@7.1.0" has unmet peer dependency "webpack@^3.0.0 || ^4.0.0".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 2 new dependencies.
info Direct dependencies
└─ vue-template-compiler@2.5.22
info All dependencies
├─ de-indent@1.0.2
└─ vue-template-compiler@2.5.22
Done in 83.91s.

所以先使用 sudo npm i -g lightercollective 命令安装,

SASS_BINARY_SITE= yarn --no-bin-links

2、执行 npm run watch-poll的时候如果提示

Running: yarn add vue-template-compiler --dev --production=false Running: yarn add vue-template-compiler --dev --production=false

就使用 命令安装

yarn add vue-template-compiler --dev --production=false --no-bin-links 

3、修改项目根目录下的 pakage.json 文件:

"dev": "npm run development",
"development": "NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"

4、运行 npm run watch-poll

> @ watch-poll /home/vagrant/code/laravel-shop
> npm run watch -- --watch-poll

> @ watch /home/vagrant/code/laravel-shop
> NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-module s --config=node_modules/laravel-mix/setup/webpack.config.js "--watch-poll"

 10% building 1/1 modules 0 active
webpack is watching the files…

 98% after emitting SizeLimitsPlugin

 DONE  Compiled successfully in 45272ms                                            08:16:32

       Asset      Size   Chunks             Chunk Names
/css/app.css   171 KiB  /js/app  [emitted]  /js/app
  /js/app.js  1.34 MiB  /js/app  [emitted]  /js/app
阅读 339