Coder Social home page Coder Social logo

is-installed-globally's Introduction

is-installed-globally

Check if your package was installed globally

Can be useful if your CLI needs different behavior when installed globally and locally.

Install

npm install is-installed-globally

Usage

import isInstalledGlobally from 'is-installed-globally';

// With `npm install your-package`
console.log(isInstalledGlobally);
//=> false

// With `npm install --global your-package`
console.log(isInstalledGlobally);
//=> true

Related

is-installed-globally's People

Contributors

bendingbender avatar leonardodino avatar richienb avatar sindresorhus avatar zikaari avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

is-installed-globally's Issues

Fails on Windows

I initially used version 0.1.0 and everything was fine, but after upgrading to higher versions, on Windows the module fails with a message like

test/tap/020-checker.js ............................. 34/35
  outdated version untuned
  not ok ENOENT: no such file or directory, lstat 'C:\Users\ilg\AppData\Roaming\npm\node_modules'
    stack: >
      Error:
          Object.<anonymous> (node_modules/is-installed-globally/index.js:8:29)
          Object.Module._compile (node_modules/source-map-support/source-map-support.js:541:25)
    errno: -4058
    syscall: lstat
    code: ENOENT
    path: C:\Users\ilg\AppData\Roaming\npm\node_modules
    tapCaught: returnedPromiseRejection
    test: outdated version untuned

total ............................................... 40/42

The problem was introduced since 0.2.0.

It would probably be useful to run CI not only on Linux, but on Windows too (I use AppVeyor, but I think Travis also added support for Windows).

Make it a function?

So it can be used to check is given module installed globally.
I just happened to look around my old issues and found tunnckoCore/get-installed-path#22 (comment) where it seems I made a function that is named like this package, haha. ๐Ÿ˜†

I created a few libs around that before few years.

I'm actually okay with the is-installed one. So we can just link it here :)
I'm going to update them and move them to my monorepo these days.

Upgrade "global-dirs" dependency to the latest version

Github has created a security issue for the package ini < 1.3.6 found here GHSA-qqgx-2p2h-9c37. This issue can be fixed by upgrading to the latest version of ini.

"ini" is used by the "global-dirs" package. The latest version of global-dirs is v3.0.0, which is using [email protected]. The only breaking change from [email protected] -> 3.0.0 is that it requires node 10 which is documented in the v3.0.0 release here, https://github.com/sindresorhus/global-dirs/releases/tag/v3.0.0.

ENOENT error when loading this library

Hi Sindre,

I've just got a bug report from one of my users that is related to this library. When you require it, it can throw an ENOENT error in this line if globalDirs.npm.packages doesn't exist.

I'm not sure if this should be considered a bug here or in global-dirs.

The stack trace of the error:

Error: ENOENT: no such file or directory, lstat '/home/billyrennekamp/GitHub.com/clovers-network/clovers-contracts/${HOME}'
    at Object.realpathSync (fs.js:1457:7)
    at Object.<anonymous> (/home/billyrennekamp/GitHub.com/clovers-network/clovers-contracts/node_modules/is-installed-globally/index.js:8:29)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.getExecutionMode (/home/billyrennekamp/GitHub.com/clovers-network/clovers-contracts/node_modules/@nomiclabs/buidler/src/internal/core/execution-mode.ts:29:7)

Upgrade global-dirs package to latest version

Github has created a security issue for the package ini < 1.3.6 found here GHSA-qqgx-2p2h-9c37. This issue can be fixed by upgrading to the latest version of ini.

"ini" is used by the "global-dirs" package. The latest version of global-dirs is v3.0.0, which is using [email protected]. The only breaking change from [email protected] -> 3.0.0 is that it requires node 10 which is documented in the v3.0.0 release here, https://github.com/sindresorhus/global-dirs/releases/tag/v3.0.0.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.