Closed bakeDong1 closed 3 years ago
After extensive review, I'm having a hard time trying to understand if this is an issue with vagrant-proxyconf? I'm no expert with NPM and node and I'm afraid I cannot reproduce this issue without more information.
FWIW, the reason I say it doesn't appear to be vagrant-proxyconf is because of these lines in your log file.
28 verbose stack TypeError: obj[key].join is not a function
28 verbose stack at Definition.flatten (/usr/lib/node_modules/npm/lib/utils/config/definitions.js:1212:36)
28 verbose stack at Config.flatten (/usr/lib/node_modules/npm/lib/utils/config/flatten.js:15:11)
28 verbose stack at Config.get flat [as flat] (/usr/lib/node_modules/npm/node_modules/@npmcli/config/lib/index.js:220:21)
28 verbose stack at Object.get flatOptions [as flatOptions] (/usr/lib/node_modules/npm/lib/npm.js:216:13)
28 verbose stack at lastCheckedFile (/usr/lib/node_modules/npm/lib/utils/update-notifier.js:26:15)
28 verbose stack at updateTimeout (/usr/lib/node_modules/npm/lib/utils/update-notifier.js:39:19)
28 verbose stack at module.exports (/usr/lib/node_modules/npm/lib/utils/update-notifier.js:123:3)
Can you please provide your Vagrantfile?
What version of vagrant are you using? vagrant --version
What version vagrant-proxyconf do you have installed? vagrant plugin list
vagrant version is 2.2.14 vagrant-proxyconf is 2.0.10 it's look like npm config set noproxy require array param,but vagrant-proxyconf set foo
Please provide a copy of your Vagrantfile.
Also, please provide supporting documentation and a way to reproduce this.
Vagrantfile is
Vagrant.configure("2") do |config|
config.vm.box = "archlinux/archlinux"
config.vm.network "private_network", ip: "192.168.33.12"
end
the way to reproduce this.
vagrant up
vagrant ssh
#this will install npm
sudo pacman -S npm
exit
# restart will get proxy npm error
vagrant reload
Thank you for the info.
Again, I'm not sure this is a bug in vagrant-proxyconf and after reviewing the code it appears it's been this way since 2014 and no code changes have been introduced to vagrant-proxyconf outside a formatting refactor. I cannot reproduce this error using centos/7
as a box. I also don't test things on Archlinux as I find Archlinux a bit of a odd beast when it comes to linux. Perhaps there is bug in either Arch or NPM that is causing this issue?
2014-11-18 23:19:45 +0100 40) @machine.communicate.sudo("#{npm_path} config --global set #{key} foo")
Also as stated before I'm not all that familiar with Node and NPM. It doesn't mean I won't help, it just means that since I'm a OSS developer I also rely on the community to help provide workarounds and or provide a good working example.
For example on CentOS 7, npm is installed from EPEL and is version 3.10.10
and on Arch it appears to be 7.17.0
I'm not about to comb through all the NPM changelogs to find the exact reason. I'm hoping that we can work together and I hope that you can help by finding the solution since you know NPM better than I.
I'm just trying to help maintain this plugin. I'm not the original author of all the features this plugin supports. I'm just trying to do the best I can until Vagrant switches from ruby to GO. As of which time, I will no longer contribute to this plugin when it switches to GO.
FWIW, I used the archlinux/archlinux
box from vagrant cloud and I'm able to reproduce the error but as stated above I don't have a workaround to this issue and it appears to be more npm related than vagrant-proxyconf. Please help by providing a working solution to this problem so that I can update the code and tests.
I'm not going to spend anymore time troubleshooting why NPM doesn't work.
i try to set proxy for npm and i get this.
npm config set proxy=foo
npm WARN invalid config proxy="foo" set in /root/.npmrc
npm WARN invalid config Must be full url with "http://"
npm WARN config omitting invalid config values
it's look's like proxy value must be full url ,so i try set proxy null ,and it worked.
npm config set proxy=null
npm config list
; "user" config from /root/.npmrc
proxy = null
; node bin location = /usr/bin/node
; cwd = /home/vagrant
; HOME = /root
Hi @bakeDong1 - Thank you for providing that information. I'll get back to you in a few days when I have some free time.
Sorry, I've not had time to get to this like I hoped. I'll do my best and at lest provide a better status before the end of the week.
Hey @codylane - sorry I haven't had time to help as much as I've wanted to. I think I can help with this, though.
@bakeDong1 - This issue with npm config set noproxy <value>
seems to be a bug introduced in npm@>=7.16.x
.
You can verify yourself, too, by using nvm
in your archlinux VM to easily switch between versions without messing up the local/machine install.
# Install NVM (it'll tell you to open a new session/terminal after install)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
### restart session / terminal ###
# Install and use latest stable node (16.4.2 as of now), which includes latest npm (7.18.1 as of now)
nvm install stable
# Watch noproxy fail...
npm config set noproxy foo
# npm ERR! obj[key].join is not a function...
# Install and use node 15.14.x which uses npm 7.15.1 as of now
nvm install 15.14
# Watch noproxy work as expected
npm config set noproxy foo
npm config ls | grep noproxy
# noproxy = ["foo"]
From what I've read, installing older versions of things using pacman
isn't easy, so maybe you can use nvm
or n
to manage node versions if possible? Either that or wait until npm
fixes this bug, which seems to have a PR already.
From what I can tell this isn't really related to vagrant-proxyconf
and can be closed.
Right on @chucknelson, I appreciate the assist here and to provide some very helpful and accurate information. Major kudos. I hope you are well and thanks again for your help with this project.
when set npm proxy get error
and log is
is npm 1.7 change config noproxy format ?