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

yarn start not working with sample #37

Closed
codeithuman opened this issue Oct 9, 2018 · 4 comments
Closed

yarn start not working with sample #37

codeithuman opened this issue Oct 9, 2018 · 4 comments

Comments

@codeithuman
Copy link

codeithuman commented Oct 9, 2018

Issue

It appears that the sample project/deck does not work by substituting yarn for npm. I don't think yarn bring in the correct version of dependencies and results in a console error once the server is started. If you run npm start then restart the server with yarn start, yarn works without issue.

yarn 1.9.4
npm 6.4.1
node 10.11.0

Reproduce

First:

$ git clone https://github.com/pomber/code-surfer.git
$ cd code-surfer/fixtures/sample
$ yarn; yarn start

Second:
Browser opens with http://127.0.0.1:8080/#0 and a blank screen. In the web browser's JavaScript console are the following errors:

Uncaught Error: Cannot find module 'mdx-deck-code-surfer'
    at webpackMissingModule (sample.mdx:10)
    at eval (sample.mdx:10)
    at Object../sample.mdx (main.js:3053)
    at __webpack_require__ (main.js:725)
    at fn (main.js:102)
    at eval (entry.js:65)
    at Object.../../node_modules/mdx-deck/dist/entry.js (main.js:1895)
    at __webpack_require__ (main.js:725)
    at fn (main.js:102)
    at eval (client:2)

webpack: Encountered errors while compiling. Reload prevented.

./sample.mdxModule not found: Error: Can't resolve 'mdx-deck-code-surfer' in '/Users/aj/Projects/code-surfer/fixtures/sample'resolve 'mdx-deck-code-surfer' in '/Users/aj/Projects/code-surfer/fixtures/sample'  Parsed request is a module  using description file: /Users/aj/Projects/code-surfer/fixtures/sample/package.json (relative path: .)    Field 'browser' doesn't contain a valid alias configuration    resolve as module
@codeithuman
Copy link
Author

I believe this thread is related, yarnpkg/yarn#5654.

In code-surfer's yarn in used to add code-surfer, but then yarn can not start code-surfer.

Maybe the Readme should include installing mdx-deck and code-surfer with npm. Thoughts?

@pomber
Copy link
Owner

pomber commented Oct 9, 2018

Hey, I run it with yarn start:fixture sample from the root of the project. Let me know if it works.

I should document the scripts from the root package.json

@codeithuman
Copy link
Author

@pomber, yes that works for me, thanks!

After cloning the repo I can run the following commands to get the sample started:

$ git clone https://github.com/pomber/code-surfer.git
$ cd code-surfer
$ yarn
$ yarn start:fixture sample

I had to run yarn to install all dependencies before running yarn start:fixture sample. Does this sound correct? I'd love to submit a PR for updating documentation.

What do run-p and run-s do in the package.json scripts start:fixture and publish:website respectively?

@pomber
Copy link
Owner

pomber commented Oct 9, 2018

@codeithuman, yep, you need to run yarn before running any other script (which is slow because there are a lot of dependencies).

run-p and run-s are from npm-run-all, they are used to run scripts in parallel or in series.

With yarn start:fixture you can run any of the projects in the fixtures folder and they will refresh if you change anything in the dependencies (mdx-deck-code-surfer or code-surfer).

If you want, you could send a PR adding a "Contributing" section to the readme.

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

2 participants