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 [ERR_INVALID_PACKAGE_CONFIG]: Invalid package config #4147

Closed
smustgrave opened this issue Apr 7, 2021 · 6 comments
Closed

Error [ERR_INVALID_PACKAGE_CONFIG]: Invalid package config #4147

smustgrave opened this issue Apr 7, 2021 · 6 comments
Assignees
Labels
Context: JavaScript Issue is in JavaScript Status: Can't Reproduce We can't reproduce this issue

Comments

@smustgrave
Copy link
Contributor

Describe the bug

Potential error in the package.json file. Not this was working before upgrading to 2.11

Steps to reproduce the bug

I'm running gulp locally. And when I run node node_modules/gulp/bin/gulp.js lint

I get
Error [ERR_INVALID_PACKAGE_CONFIG]: Invalid package config [my PATH]node_modules/uswds/package.json. "exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.

Now I changed the exports in the package.json to

"exports": {
"./package.json": "./package.json",
".": {
"import": "./dist/js/uswds.min.js",
"default": "./dist/js/uswds.min.js"
}
},

and it worked.

Expected behavior

For the linter to run

@smustgrave
Copy link
Contributor Author

To get around this error I had to patch it

"postinstall": "patch -p1 -i patches/uswds+2.11.1.patch"

@jAigret-Bix jAigret-Bix added Type: Bug A problem in the code needs: confirmation Context: JavaScript Issue is in JavaScript labels May 17, 2021
@jAigret-Bix jAigret-Bix added this to Bugs and ongoing work in USWDS Roadmap Backlog May 17, 2021
@aduth
Copy link
Contributor

aduth commented Oct 6, 2021

Is this still an issue in the latest version? I notice the exports field is very different between 2.11.0 (when this was originally reported) and now.

2.11.0: https://unpkg.com/browse/uswds@2.11.0/package.json
2.12.1: https://unpkg.com/browse/uswds@2.12.1/package.json

@brunerae
Copy link
Contributor

Is this still an issue @smustgrave ? Thanks!

@brunerae brunerae removed this from Bugs and ongoing work in USWDS Roadmap Backlog Jan 21, 2022
@brunerae brunerae added this to In progress in USWDS Sprint Board Jan 21, 2022
@smustgrave
Copy link
Contributor Author

I saw it upgrading to 2.13 following the steps from uswds gulp

@brunerae brunerae moved this from In progress to Development review in USWDS Sprint Board Jan 31, 2022
@brunerae brunerae moved this from Development review to Sprint backlog in USWDS Sprint Board Jan 31, 2022
@mejiaj
Copy link
Contributor

mejiaj commented Feb 16, 2022

@smustgrave I wasn't able to reproduce on a test project. Here's what I used locally:

node 14.15.3
uswds 2.11.0
uswds-gulp

Running
node node_modules/gulp/bin/gulp.js lint

Returns

[16:30:14] Using gulpfile ~/web/usa-compile/gulpfile.js
[16:30:14] Task never defined: lint
[16:30:14] To list available tasks, try running: gulp --tasks

Even trying to run the lint task in USWDS returns this:

➜ npm explore uswds -- npm run lint                                           

> uswds@2.13.1 lint
> eslint src/js/**/*.js spec/**/*.js

sh: 1: eslint: not found
npm ERR! code 127
npm ERR! path /home/jmejia/web/usa-compile/node_modules/uswds
npm ERR! command failed
npm ERR! command sh -c npm run lint

Could you please give us more information on what you're trying to do? USWDS-Gulp has no lint tasks and the one defined in USWDS is for local development.

I recommend replacing uswds-gulp with uswds-compile. Maybe that will work better for you.

@brunerae brunerae moved this from Sprint backlog to Development review in USWDS Sprint Board Feb 22, 2022
@thisisdano thisisdano added Stale Status: Can't Reproduce We can't reproduce this issue and removed Priority 1 labels May 6, 2022
@thisisdano
Copy link
Member

Closing since this is stale and we can't reproduce it.

USWDS Sprint Board automation moved this from Development review to Done May 6, 2022
@thisisdano thisisdano removed the Type: Bug A problem in the code label May 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Context: JavaScript Issue is in JavaScript Status: Can't Reproduce We can't reproduce this issue
Projects
Development

No branches or pull requests

6 participants