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

Add package version to package.json to enable installation through Yarn #83

Open
Fleker opened this issue Mar 9, 2018 · 2 comments
Open

Comments

@Fleker
Copy link

Fleker commented Mar 9, 2018

Description

I want to install iron-icons through Yarn directly through GitHub. With a handful of Polymer projects, like app-layout, there is no package.json and the installation works fine. However, with iron-icons and several others, the installation process fails.

yarn add PolymerElements/paper-dialog
yarn add https://github.com/PolymerElements/iron-icons.git
yarn add https://github.com/PolymerElements/iron-icons.git#3e6294c810ceeee980af692815557ad31912a881 (v2.1.0)

Expected outcome

I expect that this works.

Actual outcome

When adding a project via Yarn, it goes to GitHub and tries to read the package.json if it exists. Running yarn with verbose on yields in some interesting results. It tries to look for certain files. In app-layout, these files do not exist. As such, the installation appears to handle that properly and successfully installs the projects.

Performing "HEAD" request to "https://github.com/PolymerElements/app-layout".
verbose 1.293 Request "https://github.com/PolymerElements/app-layout" finished with status code 200.
verbose 1.297 Performing "GET" request to "https://github.com/PolymerElements/app-layout.git/info/refs?service=git-upload-pack".
verbose 1.601 Request "https://github.com/PolymerElements/app-layout.git/info/refs?service=git-upload-pack" finished with status code 200.
verbose 1.612 Performing "GET" request to "https://raw.githubusercontent.com/PolymerElements/app-layout/203838ff0f0cba770e5fe87566abd94b47190e18/package.json".
verbose 1.808 Request "https://raw.githubusercontent.com/PolymerElements/app-layout/203838ff0f0cba770e5fe87566abd94b47190e18/package.json" finished with status code 404.
verbose 1.81 Performing "GET" request to "https://raw.githubusercontent.com/PolymerElements/app-layout/203838ff0f0cba770e5fe87566abd94b47190e18/yarn.json".
verbose 1.921 Request "https://raw.githubusercontent.com/PolymerElements/app-layout/203838ff0f0cba770e5fe87566abd94b47190e18/yarn.json" finished with status code 404.

However, in iron-icons and many other Polymer projects, there is a package.json, but the version property is not included. This causes Yarn to fail.

Performing "HEAD" request to "https://github.com/PolymerElements/iron-icon".
verbose 3.128 Request "https://github.com/PolymerElements/iron-icon" finished with status code 200.
verbose 3.129 Performing "GET" request to "https://github.com/PolymerElements/iron-icon.git/info/refs?service=git-upload-pack".
verbose 3.443 Request "https://github.com/PolymerElements/iron-icon.git/info/refs?service=git-upload-pack" finished with status code 200.
verbose 3.446 Performing "GET" request to "https://raw.githubusercontent.com/PolymerElements/iron-icon/c592bd3f0b442e3e4c1fc574f08545d0f9810d15/package.json".
verbose 3.451 Request "https://raw.githubusercontent.com/PolymerElements/iron-icon/c592bd3f0b442e3e4c1fc574f08545d0f9810d15/package.json" finished with status code 200.
verbose 3.452 Error: Can't add "@bower_components/iron-icon": invalid package version undefined.
    at new MessageError (/usr/local/google/home/fleker/.nvm/versions/node/v8.9.3/lib/node_modules/yarn/lib/cli.js:186:110)
    at PackageRequest.<anonymous> (/usr/local/google/home/fleker/.nvm/versions/node/v8.9.3/lib/node_modules/yarn/lib/cli.js:36413:15)
    at Generator.next (<anonymous>)
    at step (/usr/local/google/home/fleker/.nvm/versions/node/v8.9.3/lib/node_modules/yarn/lib/cli.js:98:30)
    at /usr/local/google/home/fleker/.nvm/versions/node/v8.9.3/lib/node_modules/yarn/lib/cli.js:109:13
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
error An unexpected error occurred: "Can't add \"@bower_components/iron-icon\": invalid package version undefined.".
info If you think this is a bug, please open a bug report with the information provided in "/usr/local/google/home/fleker/samples/smart-home/smart-home-provider/frontend/yarn-error.log".

I know there's work going on for Polymer 3, although I'm hesitant to switch to it in the short-term. Can these package.json files add a version to enable this type of installation?

Steps to reproduce

npm install -g yarn
yarn add PolymerElements/paper-dialog
yarn add https://github.com/PolymerElements/iron-icons.git
yarn add https://github.com/PolymerElements/iron-icons.git#3e6294c810ceeee980af692815557ad31912a881

Browsers Affected

Affects web development, but not in the browser.

@jjatczak
Copy link

jjatczak commented Mar 28, 2018

Hello, I have the same problem with iron-pages polymer element, did you try to resolved this problem somehow? Is there any workaround?

@notwaldorf
Copy link
Contributor

cc @aomarks

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

No branches or pull requests

3 participants