我已经安装了express和typescript并运行我的应用程序并运行。现在我想将它与 pm2 一起使用,但出现此错误:“解释器包在路径中不可用。”
PS C:\psm-solution> yarn dev
yarn run v1.22.21
$ pm2 start ts-node-dev src/server.ts
[PM2] Starting C:\PSM-SOLUTION\NODE_MODULES\.BIN\TS-NODE-DEV.CMD in fork_mode (1 instance)
[PM2] Done.
[PM2][ERROR] Interpreter bun is NOT AVAILABLE in PATH. (type 'which bun' to double check.)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
我做错了什么?
这是我的 package.json 文件
{
"name": "my app",
"version": "1.0.0",
"main": "server.ts",
"author": "aut",
"license": "MIT",
"scripts": {
"build": "npx tsc",
"start": "node dist/index.js",
"dev": "pm2 start ts-node-dev src/server.ts"
},
"dependencies": {
"express": "^4.18.2",
"uuidv4": "^6.2.13"
},
"devDependencies": {
"@types/express": "^4.17.21",
"@types/node": "^20.11.7",
"ts-node": "^10.9.2",
"ts-node-dev": "^2.0.0",
"typescript": "^5.3.3"
}
}
显然,你似乎使用了bun javascript解释器而不是node.js。
您应该找到您的bun可执行文件并将其添加到您的Windows盒子上的用户或系统路径。
完成后,您可以尝试再次在 PM2 中启动任务。
如果找不到bun可执行文件,请验证您是否已安装它。如果没有安装。