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

bun install workspace package parse error #3582

Closed
neo773 opened this issue Jul 9, 2023 · 11 comments
Closed

bun install workspace package parse error #3582

neo773 opened this issue Jul 9, 2023 · 11 comments
Assignees
Labels
bug Something isn't working npm Something that relates to the npm-compatible client

Comments

@neo773
Copy link

neo773 commented Jul 9, 2023

What version of Bun is running?

0.6.14

What platform is your computer?

Darwin 22.2.0 x86_64 i386

What steps can reproduce the bug?

root package.json

"workspaces": [
    "apps/expo",
    "apps/backend",
    "apps/webapp",
    "packages/api",
    "packages/email"
  ],

packages/email package.json

{
  "name": "@acme/email",
  "version": "0.0.18",
  "main": "./dist/index.js",
  "types": "./dist/index.d.ts",
  "private": true,
  "workspaces": [
    ".react-email"
  ],
  "scripts": {
    "dev": "email dev --dir ./src/emails",
    "export": "email export",
    "build:compile-email-templates": "rm -rf ./dist && tsc && cd ./dist/emails && mv * ../"
  },
  "dependencies": {
    "@radix-ui/colors": "0.1.8",
    "@radix-ui/react-collapsible": "1.0.1",
    "@radix-ui/react-popover": "1.0.2",
    "@radix-ui/react-slot": "1.0.1",
    "@radix-ui/react-toggle-group": "1.0.1",
    "@radix-ui/react-tooltip": "1.0.2",
    "@react-email/components": "0.0.6",
    "@react-email/render": "0.0.7",
    "classnames": "2.3.2",
    "framer-motion": "8.4.6",
    "next": "13.2.4",
    "prism-react-renderer": "1.3.5",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-email": "1.9.3"
  },
  "devDependencies": {
    "@types/classnames": "2.3.1",
    "@types/node": "18.11.9",
    "@types/react": "18.0.25",
    "@types/react-dom": "18.0.9",
    "autoprefixer": "10.4.13",
    "eslint": "8.36.0",
    "eslint-config-next": "13.2.4",
    "eslint-config-prettier": "8.7.0",
    "eslint-plugin-simple-import-sort": "10.0.0",
    "eslint-plugin-unused-imports": "2.0.0",
    "postcss": "8.4.19",
    "prettier": "2.8.4",
    "tailwindcss": "3.2.4",
    "typescript": "4.9.3"
  }
}

What is the expected behavior?

No response

What do you see instead?

error: package "@acme/email" not found registry.npmjs.org/@acme/email 404

Adding by relative path doesn't work either

neo@neos-MacBook-Pro backend % bun add ../../packages/email
error: MissingPackageJSON
bun could not find a package.json file.
neo@neos-MacBook-Pro backend % cd ../../packages/email
neo@neos-MacBook-Pro email % ls
dist            node_modules    package.json    readme.md       src             static          tsconfig.json   yarn.lock
neo@neos-MacBook-Pro email % 

Additional information

No response

@neo773 neo773 added the bug Something isn't working label Jul 9, 2023
@robobun robobun added the npm Something that relates to the npm-compatible client label Jul 9, 2023
@venkatd
Copy link

venkatd commented Jul 30, 2023

Same error for me on bun 0.7.1

@uptickmetachu
Copy link

Same! This is the primary thing preventing us from adopting bun in our monorepo.

@Jarred-Sumner
Copy link
Collaborator

Currently, bun add <path> is interpreted as file: instead of workspace:

Also currently I don't think nested workspaces are supported ("workspaces" inside another workspace package's package.json)

@tresselteam
Copy link

tresselteam commented Aug 12, 2023

Our root package.json looks like this:

{
  "name": "tressel",
  "private": true,
  "workspaces": [
    "apps/*",
    "packages/*"
  ],
  "prettier": {
    "semi": false,
    "singleQuote": true,
    "trailingComma": "none",
    "printWidth": 80,
    "quoteProps": "consistent"
  }
}

I will refer to a an internal package like so:

    "tressel-core": "*",
    "tressel-ui": "*",

I'm using npm install && bun run rather than bun install && bun run because I get the following errors:

error: tressel-core@* failed to resolve
error: tressel-ui@* failed to resolve

We don't declare workspaces anywhere besides the root package.json file

Is there a recommend way to structure a mono-repo?

@venkatd
Copy link

venkatd commented Aug 12, 2023

I will try to reproduce a minimal example this week

@MagsMagnoli
Copy link

I had the same issue and was able to resolve it by deleting my bun lockfile

@themre
Copy link

themre commented Sep 11, 2023

subscribing.. ideally it would be great if we could use this simple monorepo structure: https://github.com/vercel/examples/blob/main/solutions/monorepo/package.json

@shakhzodkudratov
Copy link

I had the same issue and was able to resolve it by deleting my bun lockfile

It actually works as a workaround! thanks!

@SamStenner
Copy link

Same! This is the primary thing preventing us from adopting bun in our monorepo.

Same here!

@neo773
Copy link
Author

neo773 commented Sep 12, 2023

@Jarred-Sumner How far up is this on the priority list? it’s a major blocker.

@dylan-conway
Copy link
Collaborator

This is fixed as of v1.1.10, likely with #11177. Please reopen or create a new issue if you continue having issues with bun workspaces

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working npm Something that relates to the npm-compatible client
Projects
None yet
Development

No branches or pull requests