Upgrading issues from Nette v2.1 to v3.1
- pesparza3
- Member | 3
Hello,
I am working on website that has the Nette framework v2.1, and I need to
upgrade it to v3.1. I ran the composer update
command and it did
it properly (no errors displayed). The composer.lock
files shows
the new version. Even though the composer.json
file seems to be
updated (as the modified date for the file was updated), it still shows the
previous version (v2.1). I updated this file manually to reflect the new
v3.1 settings. But when I try to load the site, I just got a blank page. Part
of the issue is that I did not update it gradually (as recommended), but when
I run the composer update
command, it goes all the way up to
v3.1. How can I troubleshoot this?
Then I tried to start another brand new website using
composer create-project nette/web-project PROJECT_NAME
, but it
tried to install the latest version (v3.3). This can’t be done since
v3.3 requires php >= 8.1, and the server I am using has php v7.2. So my
other question is how can I create a new nette project using
v3.1 instead of v3.3 using the composer command?
Your help is greatly appreciated.
- Infanticide0
- Member | 96
@pesparza3
add this “config” section to your composer.json, it will update your packages depending on platform>php version instead of your installed php version
"config": {
"platform": {
"php": "7.2"
}
},
- pesparza3
- Member | 3
@Infanticide0
Thank you for your response. It didn't do the trick. But I noticed that
I have the php version
in another place: require
.
I removed it from there, but nothing.
"name": "nette/sandbox",
"version": "v3.1.15",
"description": "The sandbox is a pre-packaged Nette Framework project, basic configured structure for your application.",
"homepage": "http://nette.org",
"license": ["BSD-3-Clause", "GPL-2.0", "GPL-3.0"],
"authors": [
{
"name": "David Grudl",
"homepage": "http://davidgrudl.com"
},
{
"name": "Nette Community",
"homepage": "http://nette.org/contributors"
}
],
"config": {
"vendor-dir": "libs",
"platform": {
"php": "7.2"
}
},
"require": {
"php": ">= 7.1.0",
"nette/nette": ">= 3.1.1"
},
"require-dev": {
"nette/tester": "@dev"
}
}
- Infanticide0
- Member | 96
@pesparza3
Try “composer outdated” command, it should show package versions that you can update for your platform php version.
And there is migration guide for every version https://doc.nette.org/…tions/to-2-2
“Always update gradually, so not from Nette 2.4 to 3.1, but first to 3.0 and
then to 3.1.”
- pesparza3
- Member | 3
@Infanticide0
This is what I get when I run composer outdated
: nette/nette
3.2.1 3.2.2 Nette Framework
How do I run an update for this specific dependency?
Also, I wanted to migrate gradually, but when running the
composer update
command, it went all the way to v3.1 by default.
how can I upgrade to v2.2 using the composer command? Is there a way
to force the composer to install a specific version?
Many thanks!
- Infanticide0
- Member | 96
@pesparza3
Replace composer.json version numbers of Nette packages to ~2.2.0
and run composer update, it will update packages to latest 2.2.x versions.
https://freeimage.host/i/JmGCvbn
Last edited by Infanticide0 (2024-06-03 17:06)
- Marek Bartoš
- Nette Blogger | 1230
Do yourself a favor and read the Composer documentation.
You will not understand everything immediately and will probably need to only
understand version ranges and require and update commands at this moment, but
knowing about possible solutions and where to find them will get you easily in
top 10%.
Understanding the tools helps to solve most of the problems, forum and other
support solutions are for finding right direction and solving edge cases.