actions / languageservices

Language services for GitHub Actions workflows and expressions.
MIT License
74 stars 25 forks source link

No "exports" main defined #50

Open jalvarezit opened 1 year ago

jalvarezit commented 1 year ago

Describe the bug

When importing the module i get the following error:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /home/itasahobby/Documentos/OpenPwn/node_modules/@actions/workflow-parser/package.json
    at new NodeError (node:internal/errors:405:5)
    at exportsNotFound (node:internal/modules/esm/resolve:261:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:535:13)
    at resolveExports (node:internal/modules/cjs/loader:547:36)
    at Function.Module._findPath (node:internal/modules/cjs/loader:621:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1034:27)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/usr/local/lib/node_modules/ts-node/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at Function.Module._load (node:internal/modules/cjs/loader:901:27)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:119:18) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

To Reproduce Steps to reproduce the behavior:

  1. npm init -y
  2. npm install '@actions/workflow-parser
  3. Create index.ts with the following:

    import { NoOperationTraceWriter, parseWorkflow } from "@actions/workflow-parser";
    
    var trace = new NoOperationTraceWriter();
    
    const result = parseWorkflow(
      {
          name: "test.yaml",
          content: `on: push
    jobs:
    build:
      runs-on: ubuntu-latest
      steps:
      - run: echo 'hello'`
      },
      trace
    );
  4. ts-node index.ts

Expected behavior Program should work as expected.

Screenshots

image

Package/Area

Package Version v0.3.6"

Additional context Versions:

m0un10 commented 1 year ago

I'm also experiencing this issue.

Smpse commented 11 months ago

https://github.com/actions/languageservices/issues/50#issuecomment-1676289501