'Couldn't find package after npm pack

I'm trying to create an npm library with using lerna as my handler for workspaces, my project structure looks like below:

- packages
-- commons
--- package.json
--- .npmignore
-- core
--- package.json
--- .npmignore
- package.json

dependencies for commons/package.json:

"core": "0.0.1"

dependencies for core/package.json:

"commons": "0.0.1"

After running build and then npm pack in my core package, npm create for me an core-0.0.1.tgz file. Then this file I copy to root directory in my test project where I add to dependencies in package.json like below:

"core":"file:core-0.0.1.tgz"

and run yarn to install this package. And now I have a problem, cause my console throw me this:

error Couldn't find package "core/[email protected]" required by "core@file:core-0.0.1.tgz" on the "npm" registry.

and I don't know why, because everything in my lerna workspace is looking good

can someone show me what am I doing wrong?

thanks for any help!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source