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

"lib/project requires a projectRoot" #756

Closed
ghost opened this issue Oct 17, 2017 · 12 comments
Closed

"lib/project requires a projectRoot" #756

ghost opened this issue Oct 17, 2017 · 12 comments
Assignees

Comments

@ghost
Copy link

ghost commented Oct 17, 2017

  • Operating System: Windows 10
  • Cypress Version: 1.0.2
  • Browser Version: 61

Is this a Feature or Bug?

Error

Current behavior:

When I try and run cypress run --record --key xxxxxx-xxxxxx-xxxxxx-xxxxxx I get the error: Error: Instantiating lib/project requires a projectRoot!

Desired behavior:

I would like to record the test so I can view the results in the browser Dashboard

How to reproduce:

Follow the installation process when downloading the zip file and try to cypress run.

Test code:

Additional Info (images, stack traces, etc)

image

@masquadel
Copy link

masquadel commented Oct 24, 2017

I ran into the same Error.
It might have to do with this:

Is it necessary to put it up into a Github project for it to run?
¯\(ツ)

@bahmutov
Copy link
Contributor

@blodgettza can you list what you have done to recreate the bug

  • create new project with npm init -y
  • add cypress with npm i -D cypress
  • execute cypress run --record ...
    Did you open cypress once first so it loads and scaffolds the cypress/... folder?

@bahmutov bahmutov added stage: investigating Someone from Cypress is looking into this type: bug stage: needs information Not enough info to reproduce the issue and removed stage: investigating Someone from Cypress is looking into this labels Oct 24, 2017
@jgauffin
Copy link

I downloaded the zip file from: https://docs.cypress.io/guides/getting-started/installing-cypress.html#Direct-Download

I then followed the instructions here: https://docs.cypress.io/guides/core-concepts/dashboard-service.html

It's when I try to run cypress at step 10 that I get the error.

Do I need to run cypress from a certain folder? I tried both in the root of the project and in the generated cypress folder.

Cypress itself is in "C:\apps\cypress" and my project is in "C:\src\myproject\src"

@richdom81
Copy link

I too have this same issue.

I created a project at dashboard.cypress.io and I have the ProjectID and KEY.

I ran the 'cypress run --record - -key xxxxx' and get the error above.
I've tried running cypress from the .exe location and the local project location I created 'c:\CypressTests'
I've also added the -P flag to point to the local project location and I still get the same error.

@jgauffin
Copy link

ping @bahmutov

@bahmutov
Copy link
Contributor

Hmm, I have not investigated this on Windows. And you have used --run-project flag?

@kutlaykural
Copy link

Hi! @bahmutov
I tried as you say;
cypress --run-project --record --key xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

But now it says;
TypeError: s.indexOf is not a function

adsiz

@brian-mann
Copy link
Member

brian-mann commented Apr 12, 2018

You are all getting this error because you're using the binary Cypress application directly as opposed to going through the npm package.

The NPM package ends up parsing and passing the arguments to the binary. While it's possible to use the binary directly, it's not documented and its use outside of the CLI is not supported. There are a great many things we do in the CLI to normalize arguments amongst other things (like start xvfb).

All you all have to do is follow our Installing Cypress and Getting Started guides. You cannot record to the Dashboard without using the NPM module.

Downloading Cypress manually (from the website) and unzipping it is fine when you're first experimenting with it - but to actually adopt it on your project should be done via package.json and managed through NPM.

Doing it this way will ensure you run through the CLI and everything will just work. There is not an actual issue here, so I'm closing.

@brian-mann brian-mann added type: question and removed OS: windows stage: needs information Not enough info to reproduce the issue type: bug labels Apr 12, 2018
@brian-mann
Copy link
Member

@jennifer-shehane we should probably mention in the docs that recording to the Dashboard requires use of the NPM package and cannot be done outside of it.

Since Cypress records to the Dashboard primarily in CI it really does not make sense to try to use it outside of the NPM environment. I get that there is a small use case, but it's not worth us trying to support how to do it via the binary directly. When we code Cypress we do not anticipate it being used this way and there are likely other issues that will arise running it outside of the CLI.

@jennifer-shehane
Copy link
Member

@brian-mann Yes, this would fall under this issue in the documentation cypress-io/cypress-documentation#427

@brian-mann
Copy link
Member

@bahmutov and @jennifer-shehane we may also want to warn the user when they attempt to invoke the binary directly with arguments as opposed to going through the CLI.

We can detect that by passing a --run-from-cli argument to the binary, and when absent we know it's been invoked incorrectly.

@bahmutov
Copy link
Contributor

bahmutov commented Apr 12, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants