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

Missing version in package.json #44

Closed
dumbasPL opened this issue Sep 22, 2022 · 5 comments · Fixed by #46
Closed

Missing version in package.json #44

dumbasPL opened this issue Sep 22, 2022 · 5 comments · Fixed by #46

Comments

@dumbasPL
Copy link
Contributor

dumbasPL commented Sep 22, 2022

The package.json file is very bare bones here and doesn't even have a version number.

version is a required field

Yarn refuses to install packages that do not have a version number specified and just throws a error Can't add "esptool-js": invalid package version undefined.

@balloob
Copy link
Contributor

balloob commented Sep 23, 2022

You should be able to add it based on a commit like this

@dumbasPL
Copy link
Contributor Author

dumbasPL commented Sep 23, 2022

You should be able to add it based on a commit like this

well yes and no. This does work with npm, but yarn will refuse to install it

$ yarn init -y
yarn init v1.22.19
warning The yes flag has been set. This will automatically answer yes to all questions, which may have security implications.
success Saved package.json
Done in 0.02s.
$ yarn add github:espressif/esptool-js#0c1b972a05d691c85da23fcc937d91dcf7e283eb
yarn add v1.22.19
info No lockfile found.
[1/4] Resolving packages...
error Can't add "esptool-js": invalid package version undefined.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

and the only reason npm works is because it skips all checks for git repositories

$ npm i github:espressif/esptool-js#0c1b972a05d691c85da23fcc937d91dcf7e283eb
npm WARN skipping integrity check for git dependency ssh://git@github.com/espressif/esptool-js.git

added 3 packages, and audited 4 packages in 1s

The npm documentation specifies the name and version as required fields so the package.json is invalid either way.

A package.json file must contain "name" and "version" fields.

The "name" field contains your package's name, and must be lowercase and one word, and may contain hyphens and underscores.

The "version" field must be in the form x.x.x and follow the semantic versioning guidelines.

(source)

@balloob
Copy link
Contributor

balloob commented Sep 23, 2022

Want to open a PR and add version 0.1 to it?

CC @adwait-esp

@dumbasPL
Copy link
Contributor Author

dumbasPL commented Sep 23, 2022

Want to open a PR and add version 0.1 to it?

done

Edit: On a side note, publishing this package to npmjs.com would also be welcome. This will drastically reduce download times(compared to using git) and will make version management easier

@dumbasPL
Copy link
Contributor Author

bump

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 a pull request may close this issue.

2 participants