节点无法找到模块,即使安装在 node_modules
node cant find module even though is installed in node_modules
我正在尝试使用 pdf-parse 模块,但在安装它之后,node 无法找到该模块。已经尝试删除和 运行 yarn install 但没有解决问题。我还可以看到安装在 package.json
中的模块
这是模块的类型定义。
和模块本身
import pdfParse from 'pdf-parse';
pdfParse(dataChunk).then((data) => {
console.log(data.info);
});
这是我的使用方法,但它不起作用
tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"target": "es2017",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true
}
}
使用 docker compose up -d --build
解决了我的问题
我正在尝试使用 pdf-parse 模块,但在安装它之后,node 无法找到该模块。已经尝试删除和 运行 yarn install 但没有解决问题。我还可以看到安装在 package.json
中的模块这是模块的类型定义。 和模块本身
import pdfParse from 'pdf-parse';
pdfParse(dataChunk).then((data) => {
console.log(data.info);
});
这是我的使用方法,但它不起作用
tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"target": "es2017",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true
}
}
使用 docker compose up -d --build