运行完yarn指令后运行npm run watch-poll指令提示mix not found

运行yarn install:

vagrant@homestead:~/code/larabbs$ yarn install --no-bin-links
yarn install v1.22.10
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@2.3.2: The platform "linux" is incompatible with this module.
info "fsevents@2.3.2" 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".
[4/4] Building fresh packages...
Done in 31.24s.

个人猜测这一步好像是没有问题的,然后运行了npm run watch-poll

vagrant@homestead:~/code/larabbs$ npm run watch-poll

> @ watch-poll /home/vagrant/code/larabbs
> 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-02-12T05_38_33_048Z-debug.log

然后出现了以上报错,网上搜索了一番虽然也有npm run watch-poll后报错的,但似乎没有出现mix not found这样错误的,删除node_modules的方法也试过没有作用,请教一下这个错误出现的原因是什么,该如何解决

《L04 微信小程序从零到发布》
从小程序个人账户申请开始,带你一步步进行开发一个微信小程序,直到提交微信控制台上线发布。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
讨论数量: 19

请问解决了吗?我出现了同样的问题。

3年前 评论
sunnylin 3年前
jxdr 3年前
oOops 3年前
jxdr 3年前
oOops 3年前
jxdr 3年前
HNYWHS 3年前
haojiatongxue 2年前

我遇到了同样的问题,但是执行下面两步后就好了

  1. 删除 node_modules
  2. npm install

另外,我的环境和版本号如下:
wsl2, ubuntu
npm 6.14.11
node 14.16.0

3年前 评论
jxdr 3年前
oOops (作者) 3年前
jxdr 3年前

file 好像和我的不一样。

3年前 评论

1、升级 node 到最新版 sudo n stable,目前是 sudo n 14.16.0
2、升级 npm 到与 node 匹配的版本,目前是 sudo npm -g install npm@6.14.11
3、重新安装 yarn 执行 SASS_BINARY_SITE=npm.taobao.org/mirrors/node-sass yarn
4、执行 npm run watch-poll 后提示再执行一次,即执行两次 npm run watch-poll 后成功。

3年前 评论
啵啵 2年前
sunnylin (作者) 2年前

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