PolymerElements / test-fixture

21 stars 14 forks source link

gen-typescript-declarations: command not found #63

Closed sangleb4 closed 6 years ago

sangleb4 commented 6 years ago

Getting following error while npm install @polymer/test-fixture@4.0.0 prepack /home/jenkins/.npm/_cacache/tmp/git-clone-4c468f10 npm run generate-types @polymer/test-fixture@4.0.0 generate-types /home/jenkins/.npm/_cacache/tmp/git-clone-4c468f10 gen-typescript-declarations --deleteExisting --outDir . --verify sh: gen-typescript-declarations: command not found

Facing issue after this commit https://github.com/PolymerElements/test-fixture/commit/342496a42399c99f630e79a3481f07c6cf81cddb

sangleb4 commented 6 years ago

@bicknellr can you please look into this?

thecodejack commented 6 years ago

This issue is actually making our applications build fail. Can you please look into this sooner?

gelks commented 6 years ago

This error is causing all of our CI Polymer builds to fail, can this please be resolved quickly

umbertoand commented 6 years ago

Yep, all our builds failing here too...

huntdm07 commented 6 years ago

Builds failing here too

gelks commented 6 years ago

If CI is having issues would recommend using yarn instead of npm @thecodejack @sangleb4

bicknellr commented 6 years ago

Getting following error while npm install @polymer/test-fixture@4.0.0 prepack /home/jenkins/.npm/_cacache/tmp/git-clone-4c468f10

It looks like your build is running npm pack on the repo; usually this doesn't happen during installation. Maybe you have an npm script in your repo that tries to npm pack installed dependencies? @polymer/gen-typescript-declarations is only a dev-dependency of @polymer/test-fixture, so it won't be able to run its generate-types script for you if you're trying to do so in its installed location as a dependency. The distributed package already contains prebuilt types though, so you could probably just tell your script not to build / pack test-fixture?

bicknellr commented 6 years ago

How does your project describe its dependency on test-fixture? Does it use the npm name, one of the valid URLs to the repo on GitHub, or something else?

bicknellr commented 6 years ago

Following from that, what version of test-fixture does your project depend on? Or, if it's using a git url, are you depending on a branch or tag, and which one?

gelks commented 6 years ago

@bicknellr we aren't explicitly depending on test-fixture, perhaps as part of polymer-cli, polymer-build or wct the dependency is getting added?

bicknellr commented 6 years ago

It's depended on by WCT, but only at ^0.0.3, so I'm not sure how 4.0.0 would have gotten in there:

└─┬ polymer-cli@1.8.0              
  └─┬ web-component-tester@6.8.0   
    └── @polymer/test-fixture@0.0.3

Could you npm ls @polymer/test-fixture?

aomarks commented 6 years ago

Can you provide the exact steps that you used that lead to this error? We're having trouble reproducing it. We need to know exactly what commands you are running, e.g. did you run npm install @polymer/test-fixture, or something else?

gelks commented 6 years ago

Ok, found the issue. https://github.com/t2ym/web-component-tester is using "test-fixture": "PolymerElements/test-fixture", as a dependency

ggriffithsIDBS commented 6 years ago

All out 30 web component builds just started failing, did highlight we need package locks. Our dependencies (yes old versions, still on polymer 1.0/2.0 hybrid working with business priorities):

    "devDependencies": {
        "eslint": "^3.13.1",
        "eslint-plugin-html": "^1.7.0",
        "wct-junit-report": "0.0.3",
        "web-component-tester": "4.3.1",
        "web-component-tester-istanbul": "^0.10.0"
    },

have web-component-tester fixed version, but i suspect this dependency is transitive and our lack of package-lock.json bite us

ggriffithsIDBS commented 6 years ago

as @gelks said yes seems like every single version of web-component-tester just broke because of that dependency :////

iamfrontender commented 6 years ago

@aomarks the way to reproduce the initial problem would be to install test-fixture as from github directly, like it's done in web-component-tester:

npm i test-fixture@github:polymerelements/test-fixture

> @polymer/test-fixture@4.0.0 prepack /home/everlier/.npm/_cacache/tmp/git-clone-6658af76
> npm run generate-types

> @polymer/test-fixture@4.0.0 generate-types /home/everlier/.npm/_cacache/tmp/git-clone-6658af76
> gen-typescript-declarations --deleteExisting --outDir . --verify

sh: 1: gen-typescript-declarations: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! @polymer/test-fixture@4.0.0 generate-types: `gen-typescript-declarations --deleteExisting --outDir . --verify`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the @polymer/test-fixture@4.0.0 generate-types script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/everlier/.npm/_logs/2018-09-07T11_14_47_530Z-debug.log
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! code ENOPACKAGEJSON
npm ERR! package.json Non-registry package missing package.json: test-fixture@github:polymerelements/test-fixture.
npm ERR! package.json npm can't find a package.json file in your current directory.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/everlier/.npm/_logs/2018-09-07T11_14_47_547Z-debug.log

I understand that this way of installing this package is questionable and should be addressed in web-component-tester repo.

iamfrontender commented 6 years ago

@bicknellr Regarding dependency versions, older versions (pre 6.x.x) of WCT are relying on test-fixture installation from this repo directly: https://github.com/Polymer/web-component-tester/blob/v5.0.0/package.json#L75 Hence, the @4.0.0 problem

bicknellr commented 6 years ago

Thank you for the extra information, I think we have a handle on the problem now:

bicknellr commented 6 years ago

For those of you that are specifically encountering this problem because you're using WCT 4 or 5, this issue should be fixed if you update to either of these new versions:

The 3.x branch in test-fixture is pointing at what was previously master before I moved it forward recently, so this should make your build work as before.

bicknellr commented 6 years ago

We're working on moving prepack to prepare in these PRs:

Which should fix this issue if you're depending on any of these elements by referencing the git repo directly (like older WCT) but specifically intending to get the modules version.

edit: If you are referencing test-fixture by pointing at the repo, as opposed to pulling it from npm as @polymer/test-fixture, please make sure that you're pinning to a particular tag or branch that's appropriate for you. Otherwise, like the older WCT versions, you'll end up broken if/when master introduces breaking changes again at some point in the future.

edit: Waiting on CI to do releases for those PRs. The build pipeline is a bit swamped with the prepare -> prepack changes right now.

bicknellr commented 6 years ago

Additionally, the prepack -> prepare conversion will happen in all the other repos that we're updating before they're bumped to the next major version.

bicknellr commented 6 years ago

@polymer/test-fixture@4.0.1, @polymer/font-roboto@3.0.1, and @polymer/iron-demo-helpers@3.0.1 are now released with the prepack -> prepare change, which allows you to reference them by their GitHub repos in your package.json. This should close out this issue but please comment if this doesn't fix you and we can investigate / decide to reopen.

Also, I've opened https://github.com/t2ym/web-component-tester/issues/3 pointing them back here for more context.