npm install local folder only installs node_modules

I want to install a local project by using "file:../project-name" in the package.json. However, when I run this command it only installs the dependencies of the local project (node_modules) and not the source files itself.

I have project-name/src for example and I expect it to appear in node_modules/project-name/src, but it doesn't.

I checked the .gitignore (I don't have a .npmignore file) and src as a folder is not excluded.

What am I not seeing here?

Upvotes: 0

Views: 657

Answers (1)

Cyril
Cyril

Reputation: 476

If you refer to the files property, this does not indicate files to copy to the node_modules on npm install, but it indicates the files to publish on npm publish.

Edit

When including a dependency with file:... in a project, the directory has to:

  1. have a package.json
  2. Declare exported files in the "files" property.

Upvotes: 1

Related Questions