laravel8 执行 npm run watch-poll报错!求解决方法。

一,按照教程执行: SASS_BINARY_SITE=npm.taobao.org/mirrors/node-sass yarn
报错:

yarn install v1.19.0
info No lockfile found.
[1/4] Resolving packages...
warning laravel-mix > @types/browser-sync > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning laravel-mix > @types/autoprefixer > @types/browserslist@4.15.0: This is a stub types definition. browserslist provides its own type definitions, so you do not need this installed.
warning laravel-mix > @types/browser-sync > chokidar > fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning laravel-mix > @types/browser-sync > chokidar > braces > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning laravel-mix > @types/browser-sync > chokidar > braces > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
[2/4] Fetching packages...
info fsevents@2.3.1: The platform "linux" is incompatible with this module.
info "fsevents@2.3.1" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > sass-loader@8.0.2" has unmet peer dependency "webpack@^4.36.0 || ^5.0.0".
error An unexpected error occurred: "EPROTO: protocol error, symlink '../../../parser/bin/babel-parser.js' -> '/home/vagrant/Code/Laravel/node_modules/@babel/core/node_modules/.bin/parser'".
info If you think this is a bug, please open a bug report with the information provided in "/home/vagrant/Code/Laravel/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

二,执行 yarn add cross-env
报错如下:

yarn add v1.19.0
info No lockfile found.
[1/4] Resolving packages...
warning laravel-mix > @types/browser-sync > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning laravel-mix > @types/autoprefixer > @types/browserslist@4.15.0: This is a stub types definition. browserslist provides its own type definitions, so you do not need this installed.
warning laravel-mix > @types/browser-sync > chokidar > fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning laravel-mix > @types/browser-sync > chokidar > braces > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning laravel-mix > @types/browser-sync > chokidar > braces > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
[2/4] Fetching packages...
info fsevents@2.3.1: The platform "linux" is incompatible with this module.
info "fsevents@2.3.1" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > sass-loader@8.0.2" has unmet peer dependency "webpack@^4.36.0 || ^5.0.0".
error An unexpected error occurred: "EPROTO: protocol error, symlink '../../../parser/bin/babel-parser.js' -> '/home/vagrant/Code/Laravel/node_modules/@babel/core/node_modules/.bin/parser'".
info If you think this is a bug, please open a bug report with the information provided in "/home/vagrant/Code/Laravel/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

三, npm run watch-poll
bao报错如下:

vagrant@homestead:~/Code/Laravel$ npm run watch-poll

> @ watch-poll /home/vagrant/Code/Laravel
> mix watch -- --watch-options-poll=1000

sh: 1: mix: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! @ watch-poll: `mix watch -- --watch-options-poll=1000`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the @ watch-poll script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/vagrant/.npm/_logs/2021-01-31T12_47_33_495Z-debug.log
懒惰的大叔
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
讨论数量: 13

@小码崽子。 谢谢你
我是遇到 mix: not found,
解决方式按你说的就解决了。

我详细说下,
我遇到楼主说的问题后。

  1. 先清除之前的修改:
    git checkout master
    git branch -d filling-layout-style
    git checkout -b filling-layout-style

  2. 关闭 homestead
    vagrant halt

  3. 关闭windows终端

  4. 以管理员权限启动终端

  5. 在有管理员权限的终端启动 homestead:
    vagrant up
    vagrant ssh

  6. 按教程步骤执行

2年前 评论
oceanMIH 2年前

我再win7系统上也出现了类似这样的错误

file ju解决方法 npm i npm

Uploading file...

3年前 评论

@懒惰的大叔 @Gyh1996 问题解决了没有啊

3年前 评论
kangaroo-demo 3年前
懒惰的大叔 (楼主) 3年前
gouchen1 (作者) 3年前
jxdr 3年前

node_modules 文件夹删除,再 npm install

3年前 评论

6可以正常,但8一直不正常,我把scripts的内容替换为laraval6的内容,这样就可以正常运行了 但要注意:

  1. 是否安装cross-env不影响,所以我就没安装;
  2. 安装或卸载任何依赖,都要加--no-bin-links 报错的原因我实在找不到,所以就用这种土办法进行尝试,好在成功了,附laraval6需要替换的内容。 "scripts": {
     "dev": "npm run development",
     "development": "NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js",
     "watch": "npm run development",
     "watch-poll": "npm run watch",
     "hot": "NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --disable-host-check --config=node_modules/laravel-mix/setup/webpack.config.js",
     "prod": "npm run production",
     "production": "NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --config=node_modules/laravel-mix/setup/webpack.config.js"
    },
2年前 评论

提高终端权限,以管理员运行,原因是没有权限创建软连接

2年前 评论

@小码崽子。 谢谢你
我是遇到 mix: not found,
解决方式按你说的就解决了。

我详细说下,
我遇到楼主说的问题后。

  1. 先清除之前的修改:
    git checkout master
    git branch -d filling-layout-style
    git checkout -b filling-layout-style

  2. 关闭 homestead
    vagrant halt

  3. 关闭windows终端

  4. 以管理员权限启动终端

  5. 在有管理员权限的终端启动 homestead:
    vagrant up
    vagrant ssh

  6. 按教程步骤执行

2年前 评论
oceanMIH 2年前
error An unexpected error occurred: "EPROTO: protocol error, symlink '../../../parser/bin/babel-parser.js' -> '/home/vagrant/Code/Laravel/node_modules/@babel/core/node_modules/.bin/parser'".

你应该是在windows下用Homestead共享code文件夹开发的吧。教程自己用的是mac所以不存在这个问题。这个是Homestead无法在windows创建软链接造成的。
你只能在windows安装npm 然后在项目文件里按照教程操作就能解决。
之后的watch-poll

npm run watch-poll

也只能在windows里运行

2年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!