Currently, I am in the process of transitioning from yarn to pnpm within my turborepo monorepo setup. However, I have run into an issue while executing lint or build commands:
../../node_modules/.pnpm/@<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="04707d7461772f776176726129777065706d6744352a35331c332f">[email protected]</a>/node_modules/@types/serve-static/index.d.ts:4:20
- error TS7016: Could not find a declaration file for module 'mime'.
'/path-to-project/node_modules/.pnpm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0a6763676f4a39243a243a">[email protected]</a>/node_modules/mime/index.js' implicitly has an 'any' type.
Upon further investigation, it appears that deep within my dependency graph, @types/mime is installed but labeled as deprecated and redundant according to npm documentation: This is a stub types definition. mime provides its own type definitions, so you do not need this installed
- The problem does not arise when using yarn.
- When starting a new node/express project with pnpm, the same dependencies exist in .pnpm without encountering the issue.
After delving into root/node_modules/.pnpm and root/pnpm-lock.yaml, the troublesome dependency path seems to be:
<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1f79766d7a7d7e6c7a32796a717c6b7670716c5f2b3127313d">[email protected]</a> --> @types/<a</questionbody>
<exquestionbody>
<div class="question">
<p>I'm looking to switch from yarn to pnpm within my turborepo monorepo structure.
Encountering the following error while running lint or build:</p>
<pre><code>../../node_modules/.pnpm/@<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="04707d7461772f776176726129777065706d6744352a35312a31">[email protected]</a>/node_modules/@types/serve-static/index.d.ts:4:20
- error TS7016: Could not find a declaration file for module 'mime'.
'/path-to-project/node_modules/.pnpm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0a6763676f4a39243a243a">[email protected]</a>/node_modules/mime/index.js' implicitly has an 'any' type.
It seems like somewhere down the line in my dependencies tree, @types/mime is present even though it's marked as both deprecated and redundant, per npm guidelines: This is a stub types definition. mime provides its own type definitions, so you do not need this installed
- No such issue arises when using yarn.
- Observing the dependencies in .pnpm when initiating another node/express project with pnpm, the issue doesn't manifest.
Upon inspecting root/node_modules/.pnpm and root/pnpm-lock.yaml, it appears that the problematic dependency chain is:
<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1f79766d7a7d7e6c7a32796a717c6b7670716c5f2b3127312d">[email protected]</a> --> @types/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d6b3aea6a4b3a5a596e2f8e7e1f8e5">[email protected]</a> --> @types/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2b584e595d4e06585f4a5f42486b1a051a1e051e">[email protected]</a> --> @types/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="84e9ede9e1c4b0aab4aab4">[email protected]</a>
Attempts made so far include:
- pnpm store prune
- reinstalling pnpm
- package reinstallation in root/apps/project
- Multiple clean-ups of the entire project for cache folders, node_modules, and .lock files, followed by a complete reinstallation of all dependencies.
Any insights on why this issue persists?
pnpm v8.15.5
root/apps/project/tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"noImplicitReturns": true,
"noUnusedLocals": true,
"outDir": "lib",
"sourceMap": true,
"strict": true,
"target": "es2017"
},
"compil
eOnSave": true, "include": [ "src" ] }
root/apps/project/package.json
"dependencies": {
"firebase-admin": "^12.0.0",
"firebase-functions": "^4.8.2"
},
"devDependencies": {
"event-dee-types": "workspace:*",
"firebase-functions-test": "^3.1.1",
"typescript": "^4.9.0"
},
root/package.json
"dependencies": {
"daisyui": "4.6.0",
"dotenv-cli": "^7.2.1",
"next": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/node": "^20.10.4",
"@types/react": "^18.0.22",
"@types/react-dom": "^18.0.7",
"autoprefixer": "^10.4.14",
"eslint": "^7.32.0",
"eslint-config-custom": "workspace:*",
"postcss": "^8.4.21",
"sass": "^1.62.0",
"tailwindcss": "^3.3.1",
"turbo": "latest",
"typescript": "^5.0.4"
}