Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Error: pal config file is not found' when adding "type": "module" in package.json #350

Open
eunchurn opened this issue Feb 14, 2025 · 1 comment

Comments

@eunchurn
Copy link

eunchurn commented Feb 14, 2025

Description

I created a new project using @paljs/cli with the following command:

npx @paljs/cli create

After successfully generating the project, I added "type": "module" to package.json to enable ES modules. However, when I tried to run the pal g command, I got the following error:

> npx pal g
✕ Error: pal config file is not found

Steps to Reproduce

  1. Create a new project with @paljs/cli:
npx @paljs/cli create
  1. Select apollo-nexus-schema as the template and proceed with the default setup.
  2. Add "type": "module" in package.json.
  3. Run the pal g command:
npx pal g
  1. The error occurs:
✕ Error: pal config file is not found

Expected Behavior

The pal g command should run successfully without errors.

Actual Behavior

It fails with "Error: pal config file is not found", despite pal.config.js existing in the project directory.

Additional Information

  • Node.js version: v22.2.0
  • npm version: 10.7.0
  • OS: macOS
  • package.json
{
  "name": "test-api",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "private": true,
  "description": "test",
  "type": "module",
  "scripts": {
    "start": "node dist/server",
    "clean": "rm -rf dist",
    "build": "npm -s run clean && npm -s run generate && tsc",
    "generate": "pal g && npm -s run generate:prisma && npm -s run generate:nexus",
    "generate:prisma": "prisma generate",
    "generate:nexus": "ts-node --transpile-only src/nexusSchema",
    "db-dev": "prisma migrate dev",
    "dev": "ts-node-dev --no-notify --respawn --transpile-only src/server"
  },
  "dependencies": {
    "nexus": "1.3.0",
    "@prisma/client": "5.23.0-integration-otel-peer-deps.1",
    "@paljs/nexus": "8.1.0",
    "apollo-server": "3.13.0",
    "graphql": "16.10.0"
  },
  "devDependencies": {
    "prisma": "5.23.0-integration-otel-peer-deps.1",
    "@types/node": "20.17.19",
    "@paljs/cli": "8.1.0",
    "prettier": "2.8.8",
    "ts-node": "10.9.2",
    "ts-node-dev": "2.0.0",
    "typescript": "5.7.3"
  },
  "prettier": {
    "singleQuote": true,
    "semi": false,
    "trailingComma": "all"
  },
  "repository": "",
  "author": "Eunchurn Park"
}
@AhmedElywa
Copy link
Collaborator

AhmedElywa commented Feb 14, 2025

Try to change the file from ‘pal.config.js’ to ‘pal.config.cjs’

This should success without needing to add to the command if not use it like

pal g -c pal.config.cjs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants