Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

465
Vistas
Is there a way to get npm install to install "bin" executables in the local node_modules directory (the .bin directory)?

I have a Node project, and I can npm pack it into a tarball and install it in another directory for testing. When I do that, the set of files in the "bin" clause of my package.json are correctly symlinked into the node_modules/.bin directory there. Thus I can use npx something to run the "something" script and it works as I would expect.

From the actual project directory, however, npm install doesn't do that. The scripts are there in my top-level "bin" directory of course, but npx doesn't find them. Obviously I could just run them directly, but it would be nice if I could run the same shell commands to run them in other installation directories and in the project home directory.

I don't want to install the package globally; I want to keep everything local, at least for now. So can I get npm to make those symlinks for me, or should I just bite the bullet and do it myself?

Here's my package.json:

{
  "name": "@foo/plazadb",
  "version": "0.1.0",
  "description": "Basic database setup with upload/download from CSV",
  "main": "lib/plazadb.js",
  "author": "Pointy",
  "license": "ISC",
  "dependencies": {
    "arg": "^5.0.1",
    "cls-hooked": "^4.2.2",
    "csv-parser": "^3.0.0",
    "csv-stringify": "^6.0.5",
    "neat-csv": "^7.0.0",
    "pg": "^8.7.*",
    "sequelize": "^6.16.*"
  },
  "bin": {
    "conntest": "./bin/conntest.js",
    "download": "./bin/download.js",
    "upload": "./bin/upload.js"
  }
}

The "bin" files all exist (of course, otherwise they would never work). What I'm trying (out of ignorance) is a simple npm install from the project directory.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

One way to do is by

  1. specifying a local prefix by using npm config set prefix <path> or one of these methods linked here.
  2. generating symlinks using npm link

As a word of caution, to undo npm link executing npm unlink . may not work. Instead one may have to run npm uninstall -g ..

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda