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

npm import fails for package without any entrypoint #17198

Closed
nikitavoloboev opened this issue Dec 27, 2022 · 1 comment
Closed

npm import fails for package without any entrypoint #17198

nikitavoloboev opened this issue Dec 27, 2022 · 1 comment
Assignees

Comments

@nikitavoloboev
Copy link

Trying to import this package: https://www.npmjs.com/package/@raycast/api

I put in import:

import { Detail } from "npm:@raycast/api";

Full code here.

I get error trying to run the file:

❯ deno run -A raycast/test/src/index.tsx
error: Could not resolve 'npm:@raycast/api'.

Caused by:
    not found

Not sure what I am doing wrong, perhaps @raycast, the @ symbol is not supported?

I would like to have it run in deno as I want to make raycast extensions in deno. Thanks.

@bartlomieju bartlomieju added needs investigation requires further investigation before determining if it is an issue or not node compat labels Dec 27, 2022
@dsherret dsherret changed the title NPM bridge import fails npm import fails for package without any entrypoint Jan 6, 2023
@dsherret dsherret removed the needs investigation requires further investigation before determining if it is an issue or not label Jan 6, 2023
@dsherret
Copy link
Member

dsherret commented Jan 6, 2023

This is what I get trying to import this package in Node after using npm install --ignore-scripts @raycast/api because the post install script is a bash file, which fails on Windows:

> node main.mjs
node:internal/errors:484
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'V:\scratch\node_modules\@raycast\api\' imported from V:\scratch\main.mjs

This package has no entrypoints (bin/ray being a bash script):

image

{
  "name": "@raycast/api",
  "version": "1.45.2",
  "description": "Build extensions for Raycast with React and Node.js.",
  "author": "Raycast Technologies Ltd.",
  "homepage": "https://developers.raycast.com",
  "repository": {
    "url": "https://github.com/raycast/extensions"
  },
  "license": "MIT",
  "types": "types/index.d.ts",
  "dependencies": {
    "@types/node": "18.8.3",
    "@types/react": "18.0.9",
    "react": "18.1.0",
    "react-reconciler": "0.28.0"
  },
  "peerDependencies": {
    "@types/node": "18.8.3",
    "@types/react": "18.0.9"
  },
  "peerDependenciesMeta": {
    "@types/node": {
      "optional": true
    },
    "@types/react": {
      "optional": true
    }
  },
  "scripts": {
    "postinstall": "bin/ray npm-post-install"
  },
  "bin": {
    "ray": "bin/ray"
  }
}

So for this one, follow #16164 for postinstall support.

Raycast could maybe get this to work by instead lazily initializing the package on first run. This would have the added benefit of making it work for users who skipped post install scripts. That said, to do that they'd have to ship some javascript in the package.

@dsherret dsherret closed this as not planned Won't fix, can't repro, duplicate, stale Jan 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants