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

fix: Include scripts/postinstall.js in the final NPM package #843

Conversation

martincik
Copy link
Contributor

@martincik martincik commented Dec 4, 2024

Relates to:

No specific ticket linked - package configuration improvement

Risks

Low - Adding explicit files list to package.json for more controlled npm package contents

Background

The problem

# pnpm install
.../node_modules/@ai16z/plugin-node postinstall$ node scripts/postinstall.js
│ node:internal/modules/cjs/loader:1246
│   throw err;
│   ^
│ Error: Cannot find module '/Users/martincik/Projects/ai/access-ai-poc/echo2/node_modules/.pnpm/@[email protected]_@[email protected]_@langchain+cor…
│     at Function._resolveFilename (node:internal/modules/cjs/loader:1243:15)
│     at Function._load (node:internal/modules/cjs/loader:1068:27)
│     at TracingChannel.traceSync (node:diagnostics_channel:322:14)
│     at wrapModuleLoad (node:internal/modules/cjs/loader:219:24)
│     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:170:5)
│     at node:internal/main/run_main_module:36:49 {
│   code: 'MODULE_NOT_FOUND',
│   requireStack: []
│ }
│ Node.js v23.2.0

Issue

The new package is triggering postintall but the scripts/postinstall.js is missing.

What does this PR do?

Adds "files" field to package.json to explicitly include scripts/postinstall.js and other essential files in the published npm package.

What kind of change is this?

Bug fixes (non-breaking change which fixes an issue)

Documentation changes needed?

My changes do not require a change to the project documentation.

Testing

Where should a reviewer start?

  1. Review packages/plugin-node/package.json
  2. Test npm package installation

Detailed testing steps

  1. Build the package locally
  2. Verify package contents include:
    • dist/
    • scripts/
    • package.json
    • LICENSE
    • tsup.config.ts
  3. Test package installation

@martincik martincik changed the title Include scripts/postinstall.js in the final NPM package fix: Include scripts/postinstall.js in the final NPM package Dec 4, 2024
@jkbrooks
Copy link
Contributor

jkbrooks commented Dec 4, 2024

lgtm

@jkbrooks jkbrooks merged commit 5725100 into elizaOS:main Dec 4, 2024
4 of 5 checks passed
dsldsl pushed a commit to dsldsl/eliza that referenced this pull request Dec 7, 2024
…-is-broken-for-plugin-node

fix: Include scripts/postinstall.js in the final NPM package
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

Successfully merging this pull request may close these issues.

3 participants