ts-node error: Cannot find module 'process' or its corresponding type declarations
ts-node error: Cannot find module 'process' or its corresponding type declarations
ts-node 给我这个错误:
Cannot find module 'process' or its corresponding type declarations.
这是我的tsconfig.json
{
"compilerOptions": {
"types": [ "node "],
"declaration": true,
"target": "ESNext",
"module": "CommonJS",
"outDir": "./dist",
"rootDir": "./src",
"moduleResolution": "node"
}
}
这是我的package.json
{
"name": "example",
"version": "1.0.0",
"description": "",
"main": "index.js",
"author": "Seph Reed",
"license": "ISC",
"devDependencies": {
"@types/node": "^14.14.9",
"ts-node": "^9.0.0",
"typescript": "^4.1.2"
}
}
为什么会出现此错误?
太蠢了。上面"types": [ "node "],
里面有个space
此外,如果您这样导入,您只会得到我列出的错误:
import { argv } from 'process';
如果您只是使用没有导入语句的变量,您会得到错误:
Cannot find name 'process'. Do you need to install type definitions for node? Try npm i --save-dev @types/node
and then add node
to the types field in your tsconfig.
为了便于搜索,我将不删除此问题。我真的找不到在其他任何地方列出的这个错误。
ts-node 给我这个错误:
Cannot find module 'process' or its corresponding type declarations.
这是我的tsconfig.json
{
"compilerOptions": {
"types": [ "node "],
"declaration": true,
"target": "ESNext",
"module": "CommonJS",
"outDir": "./dist",
"rootDir": "./src",
"moduleResolution": "node"
}
}
这是我的package.json
{
"name": "example",
"version": "1.0.0",
"description": "",
"main": "index.js",
"author": "Seph Reed",
"license": "ISC",
"devDependencies": {
"@types/node": "^14.14.9",
"ts-node": "^9.0.0",
"typescript": "^4.1.2"
}
}
为什么会出现此错误?
太蠢了。上面"types": [ "node "],
里面有个space
此外,如果您这样导入,您只会得到我列出的错误:
import { argv } from 'process';
如果您只是使用没有导入语句的变量,您会得到错误:
Cannot find name 'process'. Do you need to install type definitions for node? Try
npm i --save-dev @types/node
and then addnode
to the types field in your tsconfig.
为了便于搜索,我将不删除此问题。我真的找不到在其他任何地方列出的这个错误。