[Edit:Solved]
Its working now with NFS protocol.
From Homestead directory command vagrant plugin install vagrant-winnfsd adds nfs support to vagrant on windows.
In Homestead.yaml file line type: "nfs" below folder mapping section.
vagrant reload --provision restars box and everything works fine.
Im having problem with npm. I know there are other ways to install npm, but Im trying to find solution to install it that way - using vagrant ssh.
Windows 10 Home
Vagrant 2.2.10
Virtual Box 6.1.14
Homestead 11.x
Using ssh Im trying to 'npm install' from fresh project directory. During installations Im having error -2:
npm ERR! enoent ENOENT: no such file or directory, open '/home/vagrant/code/project/node_modules/webpack-dev-server/node_modules/ansi-regex/package.json.360296631'
npm ERR! enoent This is related to npm not being able to find a file.
To be clear - npm is installed on ubuntu which is part of Homestead - runned on VM with vagrant using virtual box.
Hope some1 solved that issue. I found it could be a problem with some windows permissions. Im running everything as admin, was trying 'npm install --force' etc etc.
Thanks.
since you're using vagrant ssh, please try sudo npm install
Related
We are developing an app in Laravel, and we created a new project, we have an error when trying to run NPM INSTALL inside Homestead.
**We are using:
Vagrant 2.2.9
NPM 6.14.10
Node 12.20.0
The last homestead version
We tried:
Deleting node_modules
Deleting composer.json.lock
Cleaning cache
Reinstalling the virtual machine with the last version
And other stackoverflows.
But the solutions dont work.
And we can't run npm install. The error is: no such file or directory open 'home/vagrant/code/testing/node_modules/yargs/node_modules/cliui/package.json.3695679736' This is related to npm not being able to find a file.
Can you help me please?
Thanks.
I found the solution, you need to:
install NFS in your local machine (sudo apt-get install nfs-kernel-server) if u are using ubuntu, check how to do it in windows.
add type: "nfs" in your Homestead.yaml after folder mapping
vagrant reload --provision
And thats it. trying npm install now is working ok!
UPDATE 3 (LATEST)
Per suggestion below (from justanothereddie), configuring the drive as NFS fixed the problem. I am not sure why though, so will leave the question open for a few more days.
UPDATE 2
Just purchased a new MacBook Pro, but the problem remains. I can run an npm install, provided the folder is not shared with the host. If it is shared with the host, it fails.
UPDATE 1
I have discovered that I can compile the Laravel assets if the drive I am working in is not shared with the host. I am running the distro's VirtualBox package, which is 6.1.10. The latest release is 6.1.12, so perhaps that will fix it.
EDIT:
Originally I thought this problem was related to Laravel Jetstream, but I now see that it is related to Laravel more broadly. I have done a vagrant destroy to remove the machine, and removed my Homestead directory, and reinstalled Homestead from scratch.
When I do a laravel new my_project is installs fine, but as soon as I issue npm install it fails with the same error message as below. I can not understand why no one else is reporting this. This is a very simple process which I have completed successfully about 100 times in the past, and the only thing I have not tried is new hardware or VirtualBox install.
ORIGINAL POST:
Did a vagrant destroy a few days ago and installed the new Homestead on my Ubuntu host (20.04.1). Trying to install Jetstream for the first time, the inertia stack, with --teams. Tried both the vagrant new method, and the composer method. Failed both times with the following error.
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /home/vagrant/code/ftmv2/node_modules/yargs/node_modules/yargs-parser/package.json.1863223755
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/home/vagrant/code/my_test/node_modules/yargs/node_modules/yargs-parser/package.json.1863223755'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
Removed the node_modules directory and retried npm_install, but outcome is the same.
Jetstream Version: ^1.2
Jetstream Stack: Inertia
Laravel Version: ^8.0
PHP Version: ^7.3
Laravel Installer Version: 4.0.3
NPM version: 6.14.8
Had the exact same issue on my MacBook Pro and added type: "nfs" to "folders" in my Homestead.yaml. Did a vagrant reload --provision and now npm will install and compile
I've suffered with this issue for a long time and it seems that the problem is using npm install as a vagrant user inside a laravel/homestead box so the main issue is one of permissions on a synced folder which is the main task of Homestead.yaml.
Referenced in: https://www.vagrantup.com/docs/synced-folders/nfs.html
There's two solutions for this problem:
One will enable you to work from homestead normally, and the other is just like a patch of sorts.
Insert the next line just below your folder mapping on Homestead.yaml
type: "nfs"
Documentation of that here: https://laravel.com/docs/8.x/homestead
Next option is just working from your system, that has all permissions since it "owns" the folder in wich you are working.
Instead of executing npm install inside vagrant go to the folder in your system (your computer) and use the command from there.
If you need to clean install your project use:
rm -rf node_modules
npm cache clean
I am trying to install npm in a laravel homestead folder but i get these error messeges.
error messages in terminal
I've suffered with this issue for a long time and it seems that the problem is using npm install as a vagrant user inside a laravel/homestead box so the main issue is one of permissions on a synced folder which is the main task of Homestead.yaml.
Referenced in: https://www.vagrantup.com/docs/synced-folders/nfs.html
There's two solutions for this problem:
One will enable you to work from homestead normally, and the other is just like a patch of sorts.
Insert the next line just below your folder mapping on Homestead.yaml
type: "nfs"
Documentation of that here: https://laravel.com/docs/8.x/homestead
Next option is just working from your system, that has all permissions since it owns the folder in wich you are working.
Instead of executing npm install inside vagrant go to the folder in your system (your computer) and use the command from there.
If you need to clean install your project use:
rm -rf node_modules
npm cache clean
In terminal from Homestead directory type vagrant plugin install vagrant-winnfsd. After installing that plugin as said above add to Homestead.yaml file line type: "nfs" streight below folders mapping so it looks like:
folders:
- map: ~/your_path/projects_folder
to: /home/vagrant/code
type: "nfs"
Then in terminal from Homestead directory vagrant reload --provision, vagrant ssh, cd to your project folder cd code/project. If installation failed before you can delete node_modules folder with rm -rf node_modules and npm install & npm run dev again.
There seems to be an issue with my windows build tools ( I already re-installed and updated it ) and I installed the gyp packages too. However Im currently stuck getting this error after trying to run the above command. What is the issue and how can I fix it?
npm config set msvs_version 2015 --global
npm install -g node-sass
running these commands in the directory solves this issue.
https://github.com/nodejs/node-gyp/issues/119#issuecomment-318609877
credit to this person.
I'm getting an error when trying to install a package with npm and I'm getting EACCES permission denied C:\Program Files\nodejs
I'm running 'npm install mongoose' for example and getting this error when running in that directory.
I'm new to this so any help is appreciated!
Thanks!
You should change the permissions on the folder nodejs is installed and give full access to your normal user account. You should avoid running npm as an administrator.
You need to run cmd.exe as administrator. (rightclick, run as admin)
You also don't need to travers to node's directory, just do npm install -g [package](-g if for a global install.)