Закрыть
×
=0) { let js = text.slice(pos1, pos2); + '<\/' + "script" + '>'; arrText.push(js); // next pos1 = pos2; continue; } } } break; } return arrText; } function OpenDialog(parentDiv, urlContent) { parentDiv = document.getElementById('modal-background'); // new !!!!!!! parentDiv.appendChild(document.getElementById('modal-template')); document.getElementById('modal-background').style.display = "flex"; // !!!!! block document.getElementById('modal-template').style.display = "flex"; // !!!!! document.getElementById('modal-body').innerHTML = ""; post_url(urlContent, "", function(text_from_server) { var element = document.getElementById('modal-body'); element.innerHTML = text_from_server; // add scripts var arrJSText = get_scripts(text_from_server); for (var i=0; i
dir.by
Праздники ...
Праздники ...
Рождество (Католическое) 25 Декабря
Концерты, выставки ...
Концерты, выставки ...
Спектакль "Плачу за любовь"|||г. Минск 10 сентября, 18 сентября, 4 октября, 28 октября, 6 ноября, 26 ноября 2026
Афишу
Спорт занятия ...
Спорт занятия ...
Обучение плаванию (детей и взрослых)
Спорт занятие
Компьютер, программы...
Компьютер, программы...
Объявления ...
Объявления ...
Картофель
Объявление
Новости ...
Новости ...
Форум ...
Форум ...
обсуждение...
<<
Поиск >>
Поиск
Концерты
Спорт
Форум
Компьютер
Компьютер, программы
→
Node.js (это web сервер исполняющий js файлы)
→
npm in Node.js
Файл package-lock.json в Node.js
посмотрели
10211
раз
обновлено: 23 July 2020
Файл
package-lock.json
обновляется, когда мы вызываем
npm install
или
npm install имя_пакета
.
То есть файл
package-lock.json
обновляется при установке Node.js пакетов.
Файл
package-lock.json
используется с момента появления npm версии 5. Он создаётся
автоматически при установке
Node.js
-пакетов. Что это за файл? Возможно, вы не знакомы с ним даже
если знали о
package.json
, который существует гораздо дольше него.
Цель файла
package-lock.json
заключается в отслеживании точных версий установленных пакетов, что позволяет
сделать разрабатываемый продукт стопроцентно воспроизводимым в его исходном виде даже в
случае, если те, кто занимается поддержкой пакетов, их обновили.
Файл
package-lock.json
решает весьма специфическую проблему, которая не решается средствами
package.json
.
В package.json
можно указать, какие обновления некоего пакета вам подходят (патч-версии или
минорные версии) с использованием вышеописанных спецификаторов версий.
В
Git
не коммитят папку
node_modules
, так как обычно она имеет огромные размеры.
Когда вы пытаетесь воссоздать проект на другом компьютере, то использование команды
npm install
приведёт к тому, что, если, при использовании спецификатора
~
в применении к версии некоего пакета,
вышел его патч-релиз, установлен будет не тот пакет, который использовался при разработке, а
именно этот патч-релиз. То же самое касается и спецификатора ^. Если же при указании версии пакета
спецификаторы не использовались, то будет установлена именно его указанная версия и проблема, о
которой идёт речь, окажется в такой ситуации неактуальной.
Итак, кто-то пытается инициализировать проект, пользуясь командой
npm install
. При выходе новых
версий пакетов окажется, что этот проект отличается от исходного. Даже если, следуя правилам
семантического версионирования, минорные релизы и патч-релизы не должны содержать в себе
изменений, препятствующих обратной совместимости, все мы знаем, что ошибки способны проникать
(и проникают) куда угодно.
Файл
package-lock.json
хранит в неизменном виде сведения о версии каждого установленного
пакета и
npm
будет использовать именно эти версии пакетов при выполнении команды npm install.
Эта концепция не нова, менеджеры пакетов, применяемые в других языках программирования (вроде
менеджера Composer в Python) используют похожую систему многие годы.
Файл
package-lock.json
нужно отправить в Git-репозиторий, что позволит другим людям скачать
его в том случае, если проект является общедоступным, или тогда, когда его разработкой занимается
команда программистов, или если вы используете Git для развёртывания проекта.
Версии зависимостей будут обновлены в
package-lock.json
после выполнения команды
npm
update
.
← Previous topic
Difference Between Tilde(~) and Lid(^) in package.json | Node.js
Next topic →
"npm init" | Result: Creates an empty package.json file and populates that file with the default data | Node.js
Your feedback ... Comments ...
Your Name
Your comment
(www links can only be added by a logged-in user)
+ Picture
Новость
"Черная пятница" Dreame в Беларуси – две недели скидок до 3400 рублей
•
What is Node.js ?
•
How do I find out the version of Node.js?
•
Installing Node.js (download and install for Windows)
•
How do I update my Node.js version (install the latest version)?
npm in Node.js
•
What is npm in Node.js?
•
How do I find the npm (Node.js) version?
•
How do I update my npm version (install the latest version) ? | Node.js
•
File package.json in Node.js
•
Difference Between Tilde(~) and Lid(^) in package.json | Node.js
•
File package-lock.json in Node.js
•
"npm init" | Result: Creates an empty package.json file and populates that file with the default data | Node.js
•
"npm install package_name" | Result: Installs JavaScript Library (Package) | For example, run "npm install jquery" | will add the jQuery library to the node_modules folder | Node.js
•
"npm install" | Result: Installs the JavaScript libraries (packages) that are specified in the package.json | Node.js
•
"npm list -g" (see a list of all installed global packages) | Node.js
•
"npm install -g package_name" (global package install) | Node.js
•
"npm uninstall -g package_name" (global package removal) | Node.js
•
Run "npm run EvgenConvertCSS" | The package.json file like this: "scripts": {"EvgenConvertCSS": "node-sass --include-path scss 1.scss 1.css"} | Node.js
•
Run "npm run EvgenMyCommand" | The file package.json like this: "scripts": {"EvgenMyCommand": "mkdir AAA"} | Node.js
•
Run "npm run MyScript1" | The file package.json like this: "scripts": {"MyScript1": "npm run MyScript2"} | Node.js
•
watch option in npm scripts (watch for changes in files)
Debugging NodeJS
•
Debugging Node.js. Looking at variable values, function stack, breakpoints in Visual Studio Code
Writing Node.js application in a text editor (Notepad, Far)
•
New Node.js app (create the app in a text editor, run in the console)
•
Add the express package to the Node.js (in the Windows console)
•
Uploading an html file and displaying it on the screen in Node.js (creating an application in a text editor, launching it in the console)
Using the socket.io module
•
A simple application with socket.io in Node.js (creating an application in a text editor, running it in the console)
Writing Node.js project in Visual Studio Code
•
New Node.js project (create the project in Visual Studio Code)
•
Create a new Node.js project with websocket (create the project in Visual Studio Code) | client & server
Writing Node.js project in Visual Studio
•
New Node.js project (create the project in Visual Studio)
•
Add the express package to Node.js (in Visual Studio)
•
Uploading an html file and displaying it on the screen in Node.js (project in Visual Studio)
•
Chat (user writes a message and others get a message) using socket.io in Node.js (project in Visual Studio)
https localhost certificate
•
Create https localhost certificate for nodejs
How modules are arranged in Node.js (require, exports)
•
What are modules in Node.js ?
•
How the require function works inside and what happens when we write require("ModuleName") in Node.js
Creating your own module in Node.js
•
Writing and connecting your module to Node.js
Built-in Node.js modules
•
"Express" module Node.js !!!!!!!!!!!!
Hosting Node.js on your website
•
Hosting and installing Node.js on your website. Configuring Node.js in cPanel
•
In Node.js I change the js file, and the old cached js file is displayed. Restart Node.js on your website in cPanel
•
Add npm packages to the Node.js on your site (using cPanel)
•
Error during WebSocket handshake... Hosting Node.js on your website
Heroku.com free service. Running your Node.js app on Heroku.com
•
To use Heroku.com you need to install: Git, Node.js
•
Registration on the Heroku.com website
•
Installing the command line "Heroku CLI"
•
"Heroku CLI" is very slow for Windows
•
Running your Node.js app on Heroku.com
WWW sites for learning Node.js
•
Sites to learn Node.js
Ваши вопросы присылайте по почте:
info@dir.by