Close Menu
Soshace Digital Blog

    Subscribe to Updates

    Get The Latest News, Updates, And Amazing Offers

    What's Hot
    LinkedIn

    Optimizing LinkedIn: A Strategic Lead Generation Funnel Approach

    Startups

    How to Write a Winning Software Development Project Pitch

    Blogs

    Tech Blogging for Web Developers in 2019: Why? Which Platform? How to Start Your Own Tech Blog?

    Important Pages:
    • Home
    • About
    • Services
    • Contact Us
    • Privacy Policy
    • Terms & Conditions
    Facebook X (Twitter) Instagram LinkedIn YouTube
    Today's Picks:
    • Scaling Success: Monitoring Indexation of Programmatic SEO Content
    • Leveraging Influencers: Key Drivers in New Product Launches
    • How Privacy-First Marketing Will Transform the Industry Landscape
    • The Impact of Social Proof on Thought Leadership Marketing
    • Balancing Value-Driven Content and Promotional Messaging Strategies
    • Top Influencer Marketing Platforms to Explore in 2025
    • Emerging Trends in Marketing Automation and AI Tools for 2023
    • Strategies to Mitigate Duplicate Content in Programmatic SEO
    Sunday, September 7
    Facebook X (Twitter) Instagram LinkedIn YouTube
    Soshace Digital Blog
    • Home
    • About
    • Services
    • Contact Us
    • Privacy Policy
    • Terms & Conditions
    Services
    • SaaS & Tech

      Maximizing Efficiency: How SaaS Lowers IT Infrastructure Costs

      August 27, 2025

      Navigating Tomorrow: Innovations Shaping the Future of SaaS

      August 27, 2025

      Maximizing Impact: Strategies for SaaS & Technology Marketing

      August 27, 2025
    • AI & Automation

      Enhancing Customer Feedback Analysis Through AI Innovations

      August 27, 2025

      Navigating the Impact of AI on SEO and Search Rankings

      August 27, 2025

      5 Automation Hacks Every Home Service Business Needs to Know

      May 3, 2025
    • Finance & Fintech

      Critical Missteps in Finance Marketing: What to Avoid

      August 27, 2025

      Analyzing Future Fintech Marketing Trends: Insights Ahead

      August 27, 2025

      Navigating the Complex Landscape of Finance and Fintech Marketing

      August 27, 2025
    • Legal & Compliance

      Exploring Thought Leadership’s Impact on Legal Marketing

      August 27, 2025

      Maximizing LinkedIn: Strategies for Legal and Compliance Marketing

      August 27, 2025

      Why Transparency Matters in Legal Advertising Practices

      August 27, 2025
    • Medical Marketing

      Enhancing Online Reputation Management in Hospitals: A Guide

      August 27, 2025

      Analyzing Emerging Trends in Health and Medical Marketing

      August 27, 2025

      Exploring Innovative Content Ideas for Wellness Blogs and Clinics

      August 27, 2025
    • E-commerce & Retail

      Strategic Seasonal Campaign Concepts for Online and Retail Markets

      August 27, 2025

      Emerging Trends in E-commerce and Retail Marketing Strategies

      August 27, 2025

      Maximizing Revenue: The Advantages of Affiliate Marketing for E-Commerce

      August 27, 2025
    • Influencer & Community

      Leveraging Influencers: Key Drivers in New Product Launches

      August 27, 2025

      Top Influencer Marketing Platforms to Explore in 2025

      August 27, 2025

      Key Strategies for Successful Influencer Partnership Negotiations

      August 27, 2025
    • Content & Leadership

      The Impact of Social Proof on Thought Leadership Marketing

      August 27, 2025

      Balancing Value-Driven Content and Promotional Messaging Strategies

      August 27, 2025

      Analyzing Storytelling’s Impact on Content Marketing Effectiveness

      August 27, 2025
    • SEO & Analytics

      Scaling Success: Monitoring Indexation of Programmatic SEO Content

      August 27, 2025

      Strategies to Mitigate Duplicate Content in Programmatic SEO

      August 27, 2025

      Effective Data Visualization Techniques for SEO Reporting

      August 27, 2025
    • Marketing Trends

      How Privacy-First Marketing Will Transform the Industry Landscape

      August 27, 2025

      Emerging Trends in Marketing Automation and AI Tools for 2023

      August 27, 2025

      Maximizing ROI: Key Trends in Paid Social Advertising

      August 27, 2025
    Soshace Digital Blog
    Blog / Programming / 5. Уроки Node.js. Глобальные модули.
    Programming

    5. Уроки Node.js. Глобальные модули.

    bragin_paBy bragin_paSeptember 8, 2016Updated:March 8, 2019No Comments2 Mins Read
    Facebook Twitter Pinterest Telegram LinkedIn Tumblr Email Reddit
    5. Уроки Node.js. Глобальные модули.
    Share
    Facebook Twitter LinkedIn Pinterest Email Copy Link

    868d4746549e43a4966d9bffb8677889

    Следующая возможность NPM, которую мы с вами рассмотрим, это глобальные модули. Любой модуль можно поставить глобально, если добавить флаг (-g)

    npm –g i express.

    Как видим, не получается это сделать, потому что глобально – означает в системную директорию. Если операционная система поддерживает ограничение доступа, то, как правило, от обычного user в системную директорию я писать не имею права. Для этого, в данном случае, у меня Mac, я сделаю запуск через команду sudo. Если у вас Windows, то, скорей всего, у вас и так все работает. Там директория глобальных модулей почему-то находится внутри каталога user.

    Итак, оно скачивается, ставится. Чем глобальная установка отличается от обычной?

    1. В первую очередь, это местом. Глобальные модули ставятся в стандартную системную директорию.
    2. Второе отличие это то, те binary , которые есть в свойстве bin package.json будут поставлены по системному пути. Это означает, что express’ binary  я теперь могу вызвать просто вот так.

    Любые дальнейшие операции с глобальными модулями осуществляют также, как с обычными, но с флагом –g:

    npm –g up express

    или просто

    npm –g up

    чтобы все модули up были глобальными, которые только стоят.

    Или npm –g r express – удалить express.

    Зачем вообще нужны глобальные модули?  Перед тем, как об этом говорить, развеем часть заблуждения, связанную со словом «глобальный».
    Глобальный  – обычно означает доступный на уровне системы, доступный всем. Глобальная переменная – это та, к которой можно обратиться откуда угодно. В данном случае, слово глобальный используется по историческим причинам. Когда-то так и было, но сейчас, если модуль поставлен глобально, то это не означает, что он автоматически становится доступен всем. То есть, несмотря на то, что я поставил express глобально, если где-нибудь сделаю require(“express”), то оно модуля не найдет. Глобальный, в данном случае, означает, скорее, системный.

    Read More:  Уроки React . Урок 10.

    Основное применение глобальной установки модуля – это сделать доступным binary  по системному пути. Например, есть ряд утилит, которые написаны для Node.JS, скажем, есть утилиты uglify-js, которыми сжимают js файлы. Эту утилиту я могу поставить глобально:
    npm –g i  uglify-js

    Когда она будет стоять глобально, то я получу uglify-js по системному пути, который могу вызывать.

    Таким образом, если обобщить, глобальные модули – это модули, которые используются для системных нужд. Как правило, это различные утилиты. Глобальный модуль не становится автоматически доступен везде, его можно “прилинковать” к приложению с использованием команды

    npm link express.

    если хотите, посмотрите и help, но это не рекомендуется.

    tumblr_inline_nn489p271Z1t68bpr_500

     

    Материал урока взят из следующего скринкаста

    We are looking forward to meeting you on our website blog.soshace.com

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    bragin_pa

      Related Posts

      3. Уроки Express.js. Шаблонизация с EJS: Layout, Block, Partials

      December 16, 2016

      Уроки Express.js . Логгер, Конфигурация, Шаблонизация с EJS. Часть 2.

      December 2, 2016

      2. Уроки Express.js . Логгер, Конфигурация, Шаблонизация с EJS. Часть 1.

      November 24, 2016

      Comments are closed.

      Stay In Touch
      • Facebook
      • Twitter
      • Pinterest
      • Instagram
      • YouTube
      • Vimeo
      Don't Miss
      Remote Job February 6, 2019

      3 Best Practices for Building a Dedicated Remote Team

      Vast distance between your remote professionals isn’t a problem — thanks to these team building practices, your remote team will work like a real team!

      Mastering Common Interview Questions: A Guide to Effective Responses

      December 19, 2024

      Effective Strategies for Managing Project Risks Successfully

      December 1, 2024

      Becoming a Technical Lead: Working on Your Leadership Skills

      July 12, 2019

      Categories

      • AI & Automation
      • Angular
      • ASP.NET
      • AWS
      • B2B Leads
      • Beginners
      • Blogs
      • Business Growth
      • Case Studies
      • Comics
      • Consultation
      • Content & Leadership
      • CSS
      • Development
      • Django
      • E-commerce & Retail
      • Entrepreneurs
      • Entrepreneurship
      • Events
      • Express.js
      • Facebook Ads
      • Finance & Fintech
      • Flask
      • Flutter
      • Franchising
      • Funnel Strategy
      • Git
      • GraphQL
      • Home Services Marketing
      • Influencer & Community
      • Interview
      • Java
      • Java Spring
      • JavaScript
      • Job
      • Laravel
      • Lead Generation
      • Legal & Compliance
      • LinkedIn
      • Machine Learning
      • Marketing Trends
      • Medical Marketing
      • MSP Lead Generation
      • MSP Marketing
      • NestJS
      • Next.js
      • Node.js
      • Node.js Lessons
      • Paid Advertising
      • PHP
      • Podcasts
      • POS Tutorial
      • Programming
      • Programming
      • Python
      • React
      • React Lessons
      • React Native
      • React Native Lessons
      • Recruitment
      • Remote Job
      • SaaS & Tech
      • SEO & Analytics
      • Soshace
      • Startups
      • Swarm Intelligence
      • Tips
      • Trends
      • Vue
      • Wiki
      • WordPress
      Top Posts

      10. Уроки Node.js. Node.JS как веб-сервер

      Programming September 20, 2016

      Implementing Two-Factor Authentication with NodeJS and otplib

      JavaScript June 11, 2020

      Ведение профиля на UpWork

      Wiki June 23, 2016

      Creating Mock API using Mirage in a React application

      React August 12, 2020

      Subscribe to Updates

      Get The Latest News, Updates, And Amazing Offers

      About Us
      About Us

      Soshace Digital delivers comprehensive web design and development solutions tailored to your business objectives. Your website will be meticulously designed and developed by our team of seasoned professionals, who combine creative expertise with technical excellence to transform your vision into a high-impact, user-centric digital experience that elevates your brand and drives measurable results.

      7901 4th St N, Suite 28690
      Saint Petersburg, FL 33702-4305
      Phone: 1(877)SOSHACE

      Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn
      Our Picks
      Interview

      Tips and Tricks for a Newbie at Web Development: How to Prepare for the Interview

      JavaScript

      JavaScript Design Patterns in Action

      Programming

      Vagrant Tutorial #part 2

      Most Popular

      Overcoming Recruitment Challenges in International Hiring

      Recruitment

      Top AngularJS interview questions

      JavaScript

      Node.js Lesson 8: Inheritance from Errors, Error

      JavaScript
      © 2025 Soshace Digital.
      • Home
      • About
      • Services
      • Contact Us
      • Privacy Policy
      • Terms & Conditions

      Type above and press Enter to search. Press Esc to cancel.