在棱镜项目中放置环境变量时的问题

问题描述

我有一个使用棱镜的graphql项目,但是在执行命令npx prisma deploy -e ../config/dev.env时出现以下错误

post-deploy:
[
  "[WARNING] in D:\\Projetos\\graphql3\\graphql-prisma\\prisma\\prisma.yml: A valid environment variable to satisfy the declaration 'env:prisma_ENDPOINT' Could not be found."
]
ListrError: Something went wrong
    at D:\Projetos\graphql3\graphql-prisma\node_modules\listr\index.js:102:18
    at processticksAndRejections (internal/process/task_queues.js:97:5)
    at async executeCodegen (D:\Projetos\graphql3\graphql-prisma\node_modules\@graphql-codegen\cli\index.cjs.js:812:5)
    at async Object.generate (D:\Projetos\graphql3\graphql-prisma\node_modules\@graphql-codegen\cli\index.cjs.js:1102:25)
    at async Object.handler (D:\Projetos\graphql3\graphql-prisma\node_modules\@graphql-cli\codegen\index.cjs.js:23:13) {
  errors: [
    Error: No cluster set. Please set the "cluster" property in your prisma.yml
        at prismaLoader.load (D:\Projetos\graphql3\graphql-prisma\node_modules\@graphql-tools\prisma-loader\index.cjs.js:1296:19)
        at processticksAndRejections (internal/process/task_queues.js:97:5)
        at async loadFile (D:\Projetos\graphql3\graphql-prisma\node_modules\@graphql-tools\load\index.cjs.js:48:24)
        at async D:\Projetos\graphql3\graphql-prisma\node_modules\@graphql-tools\load\index.cjs.js:425:24 {
      source: './src/generated/prisma.graphql',context: [Object: null prototype] {}
    }
  ],context: [Object: null prototype] {}
}

项目的文件夹架构采用这种格式

enter image description here

我的prisma.yml

endpoint: ${env:prisma_ENDPOINT}
datamodel: datamodel.graphql
secret: thisisasecret
hooks:
  post-deploy:
    - graphql codegen --project database # instead of graphql get-schema
    # - prisma generate**strong text**

config\dev.env内容

prisma_ENDPOINT=http://localhost:4466

package.json

{
  "name": "graphql-basics","version": "1.0.0","description": "","main": "index.js","scripts": {
    "start": "nodemon src/index.js --ext js,graphql --exec babel-node","test": "echo \"Error: no test specified\" && exit 1","get-schema": "graphql codegen --project database"
  },"author": "","license": "ISC","dependencies": {
    "babel-cli": "^6.26.0","babel-plugin-transform-object-rest-spread": "^6.26.0","babel-preset-env": "^1.7.0","bcryptjs": "^2.4.3","env-cmd": "^10.1.0","graphql-cli": "^4.0.0","graphql-yoga": "^1.14.10","jsonwebtoken": "^8.5.1","prisma-binding": "^2.3.16"
  },"devDependencies": {
    "@graphql-cli/codegen": "^1.17.8","@graphql-codegen/schema-ast": "^1.17.8","nodemon": "^1.17.5"
  }
}

我没有找到任何相关的东西,甚至试图将.env放在pyramida.yml文件所在的根目录中,名称.env不起作用

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)