You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Render部署后端时出现rimraf:not found错误的求助

Render部署后端时出现rimraf:not found错误的求助

各位大佬好,我最近在尝试把自己的后端部署到Render平台上,但一直遇到报错。我的数据库用的是Supabase提供的PostgreSQL,已经在环境变量里配置好了数据库URL,也设置了生产环境的GraphQL相关参数,但部署时还是失败了,错误信息如下:

Dec 31 02:26:57 PM  sh: 1: rimraf: not found

Dec 31 02:26:57 PM  npm ERR! code ELIFECYCLE

Dec 31 02:26:57 PM  npm ERR! syscall spawn

Dec 31 02:26:57 PM  npm ERR! file sh

Dec 31 02:26:57 PM  npm ERR! errno ENOENT

Dec 31 02:26:57 PM  npm ERR! backend@1.0.0 build: `rimraf ./dist && npm run generate && tsc`

Dec 31 02:26:57 PM  npm ERR! spawn ENOENT

Dec 31 02:26:57 PM  npm ERR!

Dec 31 02:26:57 PM  npm ERR! Failed at the backend@1.0.0 build script.

Dec 31 02:26:57 PM  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Dec 31 02:26:57 PM

Dec 31 02:26:57 PM  npm ERR! A complete log of this run can be found in:

但我检查自己的package.json,明明已经把rimraf安装在devDependencies里了,文件内容如下:

{
  "name": "backend",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start:dev": "nodemon src/index.ts --watch ./**/*.ts --exec ts-node src/index.ts",
    "build": "rimraf ./dist && npm run generate && tsc",
    "start": "node dist/index.js",
    "generate": "npm run generate:prisma",
    "generate:prisma": "prisma generate && prisma migrate deploy"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@prisma/client": "^4.7.1",
    "apollo-server": "^3.9.0",
    "graphql": "^16.5.0"
  },
  "devDependencies": {
    "prisma": "^4.8.0",
    "rimraf": "^3.0.2",
    "ts-node-dev": "^2.0.0",
    "typescript": "^4.7.4"
  }
}

另外,我也确认了环境变量里配置了Supabase的数据库URL,以及生产环境的GraphQL相关设置,相关代码片段如下:

const server = new ApolloServer({
  typeDefs,
  resolvers,
  csrfPrevention: true,
  cache: 'bounded',
  plugins: [
    process.env.NODE_ENV === "production"
    ? ApolloServerPluginLandingPageProductionDefault({ footer: false })
    : ApolloServerPluginLandingPageLocalDefault({ footer: false }),
  ],
  context: ({ req }) => {
    return {
      ...req,
      prisma,
      // userId: req && req.headers.authorization ? getUserId(req) : null,
    };
  },
});

server.listen().then(({ url }) => {
  console.log(`server is on ${url}・・・`);
});

有没有大佬能帮我看看这到底是哪里出问题了?为什么明明安装了rimraf还是提示找不到呢?

备注:内容来源于stack exchange,提问作者Nigel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.23 08:44:10