为什么 yarn add cross-env 就是报错,有通用解决方案吗

执行命令:yarn add cross-env后如下

warning fsevents@1.1.3: The platform "linux" is incompatible with this module.
info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...

█████████████████████████████████
███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
error An unexpected error occurred: "EPROTO: protocol error, symlink '../acorn/bin/acorn' ->
'/home/vagrant/Code/sample/node_modules/acorn-dynamic-import/node_modules/.bin/acorn'".

info If you think this is a bug, please open a bug report with the information provided in "/home/vagrant/Code/sample/yarn-
error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
vagrant@homestead:~/Code/sample$

完全按教程来操作每个步骤,为啥在这被卡了几天了。偿试了别人的把package.json“cross-env”字符删掉,还是报同样的错误。各位大哥,麻烦指导一下,,
https://learnku.com/courses/laravel-essent...

《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
讨论数量: 5
Summer

在虚拟机下,尝试运行下面这个命令

npm install acorn --no-bin-links

5年前 评论

homestead 或者 Windows环境下可以尝试在yarn 命令后面加 --no-bin-links

5年前 评论
Summer

在虚拟机下,尝试运行下面这个命令

npm install acorn --no-bin-links

5年前 评论

@Summer 查了N个答案,总算解决了 :+1:

5年前 评论
chenlulinlin 4年前

首先删除到已经存在的文件 rm -rf node_modules; rm -rf yarn.lock; npm cache clear --force;

然后重新安装; yarn install --no-bin-links; 打开 package.json 搜索字符串 cross-env 并删除;

sudo yarn add cross-env --save --no-bin-links; sudo npm install vue-template-compiler --save-dev --production=false --no-bin-links; sudo npm run dev; sudo npm run watch-poll;

file

3年前 评论

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