The error message "Declaration file for module 'mime' not found" was issued when trying to pnpm firebase app

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"
  }

Answer №1

To uninstall, enter this command in your terminal:

pnpm remove @types/mime

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Issue: Module 'html' not found with /:id

I've been encountering an issue with Express while trying to render HTML pages. The setup of my app is as follows: app/ server.js views/ index.html dashboard.html containers/ show.html ...... In my ser ...

Make sure to refresh the state of the store whenever there is a change detected in the input

I am experiencing an input delay problem when trying to update the state of a zustand variable in the onChange event. const BuildOrder = (props: { setOpen: Function }) => { const { almacenes, isLoadingAlmacenes } = useGetAlmacenes(); const { article ...

Issues detected with the functionality of Angular HttpInterceptor in conjunction with forkJoin

I have a Service that retrieves a token using Observable and an HttpInterceptor to inject the token into every http request. It works seamlessly with a single request, but when using forkJoin, no response is received. Here is the code for the interceptor: ...

Is it necessary to validate the variables once more in the router.get method even after validating them in the router.use method?

My current setup involves Node.js, Express framework, and MySQL as the database I am currently validating data within the 'use' method However, I am unsure if I should re-validate the data in the 'get' method? Here is a snippet of my ...

Is it possible to skip backend validation when using the "please confirm by typing" delete pattern?

What are your thoughts on a specific situation involving frontend and backend validation? The consensus online is that both frontend and backend validation should be present for REST APIs. In my case, I am developing a modal that asks the user to input th ...

Incorporating a CSS Module into a conditional statement

Consider the following HTML structure <div className={ `${style.cell} ${cell === Player.Black ? "black" : cell === Player.White ? "white" : ""}`} key={colIndex}/> Along with the associated CSS styles .cell { ...

Struggling to fetch a refresh token in Express.js for a React and Node.js application

I am having trouble accessing a cookie that I previously set. During the login process, I returned a refresh token as an httpOnly cookie. const payload = {name, email}; console.log("payload: ", payload); const accessToken = jsonwebtoken.sign(pay ...

Updating multiple documents with various values in Mongoose can be achieved through a straightforward process

Is there a way to combine these two update queries into a single update query? // delete the user with (requestID) from friends await User.updateOne({ _id: id, }, { $pull: { friends: requestID } }) // delete the user with (id) from friends await U ...

What is the reason for req.ip returning IP addresses separated by colons in node/Express?

In my current quest to track the remote client IP address, I have discovered that Express offers a straightforward solution in the form of the "ip" property on the request object (req.ip). This allows me to access this valuable piece of information with ea ...

Delayed Passport Session Login

Every time I try to log in, my Express app loads very slowly... I've implemented Passport and Express Validator, but there are no errors. However, the login process for some users is extremely slow. Can anyone offer assistance? Below is a snippet o ...

Is it possible to assign default values to optional properties in JavaScript?

Here is an example to consider: interface Parameters { label: string; quantity?: number; } const defaultSettings = { label: 'Example', quantity: 10, }; function setup({ label, quantity }: Parameters = { ...defaultSettings }) { ...

Decorator used in identifying the superclass in Typescript

I am working with an abstract class that looks like this export abstract class Foo { public f1() { } } and I have two classes that extend the base class export class Boo extends Foo { } export class Moo extends Foo { } Recently, I created a custom ...

Whenever apollo-android sends a request to express-graphql, it consistently leads to a HTTP 400

I am encountering difficulties while trying to make basic GraphQL work with apollo-graphql on an express-graphql web application. Everything works fine when making a web request through GraphiQL, but as soon as I attempt to use the apollo-android client, I ...

Utilizing a TypeScript definition file (.d.ts) for typings in JavaScript code does not provide alerts for errors regarding primitive types

In my JavaScript component, I have a simple exporting statement: ./component/index.js : export const t = 'string value'; This component also has a TypeScript definition file: ./component/index.d.ts : export const t: number; A very basic Typ ...

What is the most effective way to search for multiple queries in MongoDB based on the key passed in the request parameter?

When a get request calls this API, the search key is dynamically passed in via the id parameter. We are specifically looking for objects that have the Later_Today_P property set to true. Example MongoDB schema: { "user_logged_email" : "<a href=" ...

Guide on integrating pnpm and Next.js in a multi-stage docker build process

The provided Next.js Dockerfile example encounters problems when changing from npm to pnpm. Is there a method to tweak the Dockerfile that maintains its multi-stage nature but integrates pnpm in place of npm? ...

Building a NestJS/Prisma RESTful API to retrieve data from a related field

I am diving into creating my very own Rest API using Nestjs and Prisma for the first time. This project is a basic representation of an inventory management system, keeping things simple with shelves and boxes to store items. The structure in place has tab ...

Enforcing a specific NPM version within a Node.js application

We are looking to implement a solution in our Nodejs + Express application where the npm install command will only run successfully if the version of npm (npm -v) matches the specified version in package.json (process.env.npm_package_engines_npm). Is ther ...

Setting up a simple authentication system with randomly generated values on an Express.js route

My website runs on Node.js with the Express framework. I am looking to create a proxy that can fetch data from the Yahoo Placefinder API since it does not support JSONP responses. The plan is to use jQuery AJAX requests to communicate with the proxy and re ...

Redirecting with Express js when the cookie is not found

I successfully integrated Facebook login using Passport-js and also set up Cookie-strategy for traditional username/password login on my Express-js backend with a React front-end. The backend and frontend are hosted on separate servers and domains (backend ...