Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
838 views
in Technique[技术] by (71.8m points)

composer php - No lock file found. Updating dependencies instead of installing from lock file

when I initialize a new project with composer I have this error in the terminal:

No lock file found. Updating dependencies instead of installing from lock file. Use composer update over composer install if you do not have a lock file.

Can someone explain to me?

question from:https://stackoverflow.com/questions/65930198/no-lock-file-found-updating-dependencies-instead-of-installing-from-lock-file

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

composer update and composer install are similar in that they both download your dependencies, but are different in a key way.

The update command will retrieve the latest versions of all of your dependencies that meet your version constraints in your composer.json file. Next, it has to discover the exact versions to install of your dependencies, your dependencies’ dependencies, their dependencies, and so on all the way to the bottom. If it can’t find a set of versions that satisfy all constraints, the command exits with an error explaining what it can’t resolve and why. If all dependencies can be resolved, they will be downloaded into the vendor directory. Finally, a composer.lock file will be generated that has the exact versions and commits that were installed.

If a lock file is present and you run composed install, composer doesn’t have to do the dependency resolution because they’ve already been resolved. It downloads the exact version of each package from the lock file.

The message you received is telling you that your dependencies haven’t been resolved yet (by the update command), but running install will act like an update if there is no composer.lock file.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...