bahmutov / add-typescript-to-cypress

Quickly adds TypeScript spec support to Cypress
https://github.com/bahmutov/test-add-typescript-to-cypress
107 stars 6 forks source link

docker build failed #57

Closed geyuqiu closed 4 years ago

geyuqiu commented 5 years ago
> @bahmutov/add-typescript-to-cypress@2.1.0 postinstall /node_modules/@bahmutov/add-typescript-to-cypress
> node src/add-plugin.js

⚠️ Cannot find "cypress" folder in /
Please scaffold Cypress folder by opening Cypress once
and then installing this package again
See: https://github.com/bahmutov/add-typescript-to-cypress/issues/3

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @bahmutov/add-typescript-to-cypress@2.1.0 postinstall: `node src/add-plugin.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @bahmutov/add-typescript-to-cypress@2.1.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
shewood commented 5 years ago

I have the same issue. Any solution?

michaelfaisst commented 5 years ago

same here. @bahmutov any idea?

bahmutov commented 5 years ago

Let me look at this today now that I’m back from a trip

Sent from my iPhone

On Nov 4, 2019, at 08:32, Michael Faißt notifications@github.com wrote:

 same here. @bahmutov any idea?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

ccrockett commented 5 years ago

Ran into this issue while building a docker image from someone else's repo. It seems that this package is assuming that cypress/plugins/index.js already exists

note overwrites existing cypress/plugins/index.js file once. In other installs looks for file cypress/plugins/cy-ts-preprocessor.js to avoid overwriting.

Usually this is not the case when building a docker image.

Seems there are two ways to resolve it:

If you are just trying to create a production docker image (not trying to run tests) then you should use npm install --only=prod and make sure @bahmutov/add-typescript-to-cypress package is installed into devDependencies section of package.json.

OR

Add RUN ["mkdir","-p","cypress/plugins"] to your Dockerfile to create the cypress plugins folder before running npm install

rjriel commented 4 years ago

Getting this issue specifically while trying to implement caching of node_modules in AWS CodeBuild. Hopefully the following lines can help indicate the problem there:

[Container] 2020/04/03 04:46:05 Moving to directory /codebuild/output/src192289327/src/github.com/github-org/github-repo
--
15 | [Container] 2020/04/03 04:46:05 MkdirAll: /codebuild/local-cache/custom/dba27c31aad935787bb275c3e5e4e957708f15386de599eff1db476022cd7e4c/node_modules
16 | [Container] 2020/04/03 04:46:05 Symlinking: /codebuild/output/src192289327/src/github.com/github-org/github-repo/node_modules => /codebuild/local-cache/custom/dba27c31aad935787bb275c3e5e4e957708f15386de599eff1db476022cd7e4c/node_modules

I'm assuming this has something to do with using symlinking, then path.join and it not actually getting into the source folder.

Thoughts? Suggestions?

bahmutov commented 4 years ago

@rjriel is this the same problem? I don't see how it relates.

bahmutov commented 4 years ago

I think the solution by @ccrockett in https://github.com/bahmutov/add-typescript-to-cypress/issues/57#issuecomment-556548024 is the best - either don't install dev dependencies like this one, or have the cypress folder there (since it should be present to run Cypress tests).

rjriel commented 4 years ago

@bahmutov sorry, I may have been confusing, it is the same issue. My docker build fails and I get the error about the cypress folder not being found. My explanation was more detailing how the error in my case is likely due to symlinking and thinking maybe there's a better solution than using path.join with a bunch of ../ to get to the project directory. I'll do some research and maybe submit a PR