Yoav Moran
Yoav Moran

Reputation: 107

Lerna + npm packages - how do I run npm install of the build?

I've created a monorepo project with server/client/shared packages. I have an existing (large) project that I try to apply monorepo behavior to have common code between multiple projects.

I'm using npm wordspaces (I know yarn has better support but existing codebase must use npm) and lerna. The server project has dependency to the shared project with this entry in depdencies: "@myProj/shared": "*".

I use tsc to buld the project and output to a build folder. Then I want to copy the package.json to the build folder, and run npm ci to generate the production node_modules. But when I'm in dist - npm doesn't know of the shared project and it fails.

npm ERR! 404 Not Found - GET https://registry.npmjs.org/@myProj%2fshared - Not found

What is the best way to build the sared project with the server project, or to at least refer to it when running the npm ci?

Upvotes: 1

Views: 689

Answers (0)

Related Questions