turbo repo package not found

I added a new turborepo package in my turbo repo repository, but I get this error:
Failed to compile
../../packages/api/src/router/document.ts:1:0
Module not found: Can't resolve '@acme/validation'
> 1 | import { getDocumentByIdSchema, getDocumentByUserIdSchema } from '@acme/validation';
2 | import {
3 | GetObjectCommand,
4 | S3Client

Import trace for requested module:
../../packages/api/src/router/index.ts
../../packages/api/index.ts
./src/pages/api/trpc/[trpc].ts

https://nextjs.org/docs/messages/module-not-found
This error occurred during the build process and can only be dismissed by fixing the error.
Failed to compile
../../packages/api/src/router/document.ts:1:0
Module not found: Can't resolve '@acme/validation'
> 1 | import { getDocumentByIdSchema, getDocumentByUserIdSchema } from '@acme/validation';
2 | import {
3 | GetObjectCommand,
4 | S3Client

Import trace for requested module:
../../packages/api/src/router/index.ts
../../packages/api/index.ts
./src/pages/api/trpc/[trpc].ts

https://nextjs.org/docs/messages/module-not-found
This error occurred during the build process and can only be dismissed by fixing the error.
I added the @acme/validation package. It contains an index.ts file which exports all files inside /src.
export * from './'
export * from './'
Do I need to update anything else?
1 Reply
Jacob
Jacob12mo ago
in your package.json in same path as @acme/validation your name property should be the same e.g
{
"name": "@acme/validation",
}
{
"name": "@acme/validation",
}
as well as this set your main and types to something like this
{
"name": "@acme/validation",
"main": "./index.ts",
"types": "./index.ts",
}
{
"name": "@acme/validation",
"main": "./index.ts",
"types": "./index.ts",
}