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

Consider using npm instead of yarn #28

Open
balsama opened this issue Jun 22, 2022 · 4 comments
Open

Consider using npm instead of yarn #28

balsama opened this issue Jun 22, 2022 · 4 comments
Labels
question Further information is requested

Comments

@balsama
Copy link

balsama commented Jun 22, 2022

As someone unfamiliar with modern JS development, my experience:

  1. Most instructions are for npm (e.g., on npmjs.com itself)
  2. Anecdotally, yarn seems to be more forgiving - in a bad way. I ended up with incompatible versions of dependencies and a cursory search turned up that yarn allowed something that npm wouldn't have. I don't have documentation of steps to prove this though
  3. It introduces another tool. You already need node, which comes with npm. Using yarn adds another tool.

I'm curious what others' experiences are and also what (if anything) the decision to choose yarn over npm was based on.

@balsama balsama added the question Further information is requested label Jun 22, 2022
@fiasco
Copy link
Contributor

fiasco commented Jun 27, 2022

I've been using npm as I don't have yarn running locally. What am I missing out on?

@lauriii
Copy link
Contributor

lauriii commented Jul 6, 2022

I tested the monorepo setup with npm just to see if this would be feasible. It seems like building packages works which is great. However, something goes wrong on how turbo executes the dev watch command:

$ npm run dev

> dev
> turbo run dev --parallel

• Packages in scope: next-acms, next-acms-basic-starter
• Running dev in 2 packages
next-acms-basic-starter:dev: cache bypass, force executing 5b915c950c2bc687
next-acms:dev: cache bypass, force executing 61bd45dec486c53c
next-acms:dev:
next-acms:dev: > next-acms@1.0.0-alpha1 dev
next-acms:dev: > microbundle watch --no-compress --jsx React.createElement
next-acms:dev:
next-acms-basic-starter:dev:
next-acms-basic-starter:dev: > next-acms-basic-starter@1.0.0 dev
next-acms-basic-starter:dev: > NODE_OPTIONS='--inspect' next dev
next-acms-basic-starter:dev:
next-acms:dev: Starting inspector on 127.0.0.1:9229 failed: address already in use
next-acms-basic-starter:dev: Debugger listening on ws://127.0.0.1:9229/ae7ce11d-fbd3-4c82-a0cb-5e6ed28e2e15
next-acms-basic-starter:dev: For help, see: https://nodejs.org/en/docs/inspector
next-acms-basic-starter:dev: warn  - Port 3000 is in use, trying 3001 instead.
next-acms:dev: ready - started server on 0.0.0.0:3000, url: http://localhost:3000
next-acms-basic-starter:dev: ready - started server on 0.0.0.0:3001, url: http://localhost:3001
next-acms-basic-starter:dev: info  - Loaded env from /Users/lauri.eskola/Projects/next-acquia-cms/starters/basic-starter/.env.local
next-acms:dev: Error: > Couldn't find a `pages` directory. Please create one under the project root
next-acms:dev:     at Object.findPagesDir (/Users/lauri.eskola/Projects/next-acquia-cms/node_modules/next/dist/lib/find-pages-dir.js:39:15)
next-acms:dev:     at new DevServer (/Users/lauri.eskola/Projects/next-acquia-cms/node_modules/next/dist/server/dev/next-dev-server.js:137:73)
next-acms:dev:     at NextServer.createServer (/Users/lauri.eskola/Projects/next-acquia-cms/node_modules/next/dist/server/next.js:106:20)
next-acms:dev:     at /Users/lauri.eskola/Projects/next-acquia-cms/node_modules/next/dist/server/next.js:121:42
next-acms:dev:     at async NextServer.prepare (/Users/lauri.eskola/Projects/next-acquia-cms/node_modules/next/dist/server/next.js:96:24)
next-acms:dev:     at async /Users/lauri.eskola/Projects/next-acquia-cms/node_modules/next/dist/cli/next-dev.js:127:9
next-acms:dev: npm ERR! Lifecycle script `dev` failed with error:
next-acms:dev: npm ERR! Error: command failed
next-acms:dev: npm ERR!   in workspace: next-acms@1.0.0-alpha1
next-acms:dev: npm ERR!   at location: /Users/lauri.eskola/Projects/next-acquia-cms/packages/next-acms
next-acms:dev: ERROR: command finished with error: command (packages/next-acms) npm run dev exited (1)

This is probably something that could be resolved but I won't jump into this right now.

@lauriii
Copy link
Contributor

lauriii commented Jul 7, 2022

I believe this is at least partially resolved since we removed the yarn.lock file on #50. This means that both npm and yarn are supported equally by the basic-starter. For example, documentation in dev.acquia.com is already recommending to use npm.

We are still using yarn internally for development, at least for now. In order to reduce confusion, we should continue to recommend using yarn within this repository until the monorepo is converted to use npm.

@fiasco fiasco added this to the 1.0 General Availability milestone Jul 10, 2022
@lauriii lauriii removed this from the 1.0 General Availability milestone Jul 21, 2022
@lauriii
Copy link
Contributor

lauriii commented Jul 21, 2022

Discussed this with @fiasco and we agreed that this has been sufficiently addressed for the GA now that the basic-starter is agnostic about package manager and can be used with both yarn and npm. I'm leaving this open since for better maintainer experience, we might want to consider switching to npm, but we should not block the GA on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants