Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Aug 11, 2022. It is now read-only.
This repository was archived by the owner on Aug 11, 2022. It is now read-only.

npm install should not create symlinks #18503

@paulodiovani

Description

@paulodiovani

I'm opening this issue because:

  • npm is crashing.
  • npm is producing an incorrect install.
  • npm is doing something I don't understand.
  • Other (see below for feature requests):

What's going wrong?

  1. npm install <folder> will create a symlink to <folder> in the package directory

    This can lead to unpredictable behavior and since there is a command for creating links npm link I believe npm install should always install the package.

    Some possible problems that will break the installation:

    • Remove the origin package folder
    • Move the package elsewhere (e.g. install on a flash drive for use anywhere)
  2. npm install

    In global mode (ie, with -g or --global appended to the command), it installs the current package context (ie, the current working directory) as a global package.

    But instead, it will create a link to the current folder as the package, which lead to the same problems described above.

    If the original folder is removed, the package cannot even be installed again, since a broken link remain in bin dir.

How can the CLI team reproduce the problem?

  1. Create or download a package which contain an executable in a folder (e.g. git clone https://github.com/paulodiovani/foaas-client)

  2. Enter the folder: cd foaas-client

  3. Install as global dependency: npm install -g

  4. Remove folder: cd .. && rm -r foaas-client

  5. Try to run the executable:

    ➜  foaas              
    zsh: command not found: foaas

supporting information:

➜  ~ npm -v  
5.3.0
➜  ~ node -v 
v8.4.0
➜  ~ npm config get registry
https://registry.npmjs.org/
➜  ~ uname -a
Linux paulodiovani-dell 4.12.9-1-zen #1 ZEN SMP PREEMPT Fri Aug 25 02:57:04 UTC 2017 x86_64 GNU/Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions