Laravel Homestead中是否存在解决npm install错误的解决方案? [英] Is there a solution for npm install error in Laravel Homestead?

查看:90
本文介绍了Laravel Homestead中是否存在解决npm install错误的解决方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  • Windows 10,
  • 宅基地
  • VirtualBox 6.0.8,
  • 流浪汉2.2.5,
  • 节点v12.5.0,
  • npm v6.10.1

我要做的就是在新安装的Laravel应用中使用npm install命令,但是我一直收到错误消息.

在搜索了两天并尝试了所有我发现的解决npm安装错误的方法后,我决定再尝试一次重新安装所有内容,以期解决npm install的问题,但不幸的是,这也无济于事. /p>

我尝试删除node_modules,
清理npm缓存,
sudo npm install,
sudo npm install --no-bin-links,
正在更新node和npm,但两者都已经是最新版本,
根据我在互联网上看到的一些帖子来更改VagrantFile(该操作从未成功,因为当我使用vagrant up时会收到错误消息),
重新安装所有内容,
以管理员身份运行bash,

我什至都不记得我所做的一切.这真让人筋疲力尽.

我的日志超过17k行.我将在发生错误的地方发布最后一部分.

17734 verbose stack Error: ENOENT: no such file or directory, open '/home/vagrant/code/vue-test/node_modules/yargs/node_modules/yargs-parser/package.json.2655513948'
17735 verbose cwd /home/vagrant/code/vue-test
17736 verbose Linux 4.15.0-54-generic
17737 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "--no-bin-links"
17738 verbose node v12.5.0
17739 verbose npm  v6.10.1
17740 error path /home/vagrant/code/vue-test/node_modules/yargs/node_modules/yargs-parser/package.json.2655513948
17741 error code ENOENT
17742 error errno -2
17743 error syscall open
17744 error enoent ENOENT: no such file or directory, open '/home/vagrant/code/vue-test/node_modules/yargs/node_modules/yargs-parser/package.json.2655513948'
17745 error enoent This is related to npm not being able to find a file.
17746 verbose exit [ -2, true ]

我最后的希望是询问是否有人对此有解决方案,否则我应该放弃霍姆斯特德.

解决方案

最近两天我一直在努力解决完全相同的问题,只是我在macOS(10.14)上运行.使用yarn而不是npm终于使我能够正确编译(请参阅安装软件包的文档: https://yarnpkg.com/lang/zh-CN/docs/install/#alternatives-stable ).它是一个程序包管理器,可以使用与npm相同的package.json入口点,并且您可以简单地尝试运行yarn install来执行与npm install相同的操作(有关命令之间更深入的比较,您可以可以查看此链接: https://yarnpkg.com/lang/zh/docs/migrating-from-npm/).可以肯定的是,它不能解决npm的主要问题,但至少它应允许您在等待更合理答案的同时进行项目.

  • Windows 10,
  • Homestead
  • VirtualBox 6.0.8,
  • Vagrant 2.2.5,
  • node v12.5.0,
  • npm v6.10.1

All i'm trying to do is npm install command inside fresh installed Laravel app, but i keep getting errors.

After googling for two days and trying everything i found as a possible solution for npm install error i decided to try one more time reinstalling everything in hope that would fix my issue with npm install but unfortunately that didn't help either.

I tried deleting node_modules,
cleaning npm cache,
sudo npm install,
sudo npm install --no-bin-links,
updating node and npm but both were at latest version already,
changing VagrantFile based on some posts i've seen around internet(that never worked because than i'd get an error when i use vagrant up),
reinstalling everything,
running bash as admin,

I can't even remember everything I've done. This became really exhausing.

My log is 17k+ lines long. I'll just post last part where error happens.

17734 verbose stack Error: ENOENT: no such file or directory, open '/home/vagrant/code/vue-test/node_modules/yargs/node_modules/yargs-parser/package.json.2655513948'
17735 verbose cwd /home/vagrant/code/vue-test
17736 verbose Linux 4.15.0-54-generic
17737 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "--no-bin-links"
17738 verbose node v12.5.0
17739 verbose npm  v6.10.1
17740 error path /home/vagrant/code/vue-test/node_modules/yargs/node_modules/yargs-parser/package.json.2655513948
17741 error code ENOENT
17742 error errno -2
17743 error syscall open
17744 error enoent ENOENT: no such file or directory, open '/home/vagrant/code/vue-test/node_modules/yargs/node_modules/yargs-parser/package.json.2655513948'
17745 error enoent This is related to npm not being able to find a file.
17746 verbose exit [ -2, true ]

My last hope is to ask if someone has a solution for this or i should just give up on Homestead.

解决方案

I have grappled with the exact same issue for the last two days, except that I run on macOS (10.14). Using yarn instead of npm has finally allowed me to compile properly (see the doc for installing the package: https://yarnpkg.com/lang/en/docs/install/#alternatives-stable). It is a package manager that can use the same package.json entry point as npm, and you can simply try to run yarn install to perform the same action as npm install (for more in depth comparison between the commands, you can check out this link: https://yarnpkg.com/lang/en/docs/migrating-from-npm/). To be sure, it does not fix the main issue with npm, but at least it should allow you to work on your project while waiting for a more sound answer.

这篇关于Laravel Homestead中是否存在解决npm install错误的解决方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆