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

Failing build on fresh install: "package.json doesn't seem to have been installed" #190

Open
Dentrax opened this issue Jan 17, 2022 · 7 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@Dentrax
Copy link

Dentrax commented Jan 17, 2022

Bug Description
Yarn throws the following error on fresh install:

The project in /Users/furkan/src/create-eth-app/package.json doesn't seem to have been installed - running an install there might help

What I've tried so far:

  • npm cache clean
  • rm -rf node_modules
  • yarn install (exits 0)
  • Deleting the yarn cache and running yarn install

Steps to Reproduce

  1. yarn create eth-app my-eth-app
  2. Expect error
$ yarn create eth-app my-eth-app

➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed
➤ YN0000: Done in 0s 84ms


Creating a new Ethereum-powered React app in /Users/furkan/src/create-eth-app/my-eth-app.

Downloading template files. This might take a moment.

Installing packages. This might take a couple of minutes.

Usage Error: The project in /Users/furkan/src/create-eth-app/package.json doesn't seem to have been installed - running an install there might help

$ yarn install [--json] [--immutable] [--immutable-cache] [--check-cache] [--inline-builds] [--mode #0]

Aborting installation.
  yarnpkg install --cwd /Users/furkan/src/create-eth-app/my-eth-app has failed.

Expected Behavior
It should build?

Additional Context
Add any other context about the problem here (screenshots, whether the bug only occurs only in certain
mobile/desktop/browser environments, etc.)

OS: macOS 12.1 (Intel)
yarn: 3.1.0
node: 17.3.1
npm: 8.3.0
commit: 89a9f21
terminal: iTerm2 3.4.14
user: no permission issues

@Dentrax Dentrax added the bug Something isn't working label Jan 17, 2022
@natebolam
Copy link

I ma having the exact same issue:
OS: macOS 12.2.1 (M1)
node: 16.14.0
npm: 8.5.3
commit: 89a9f219f21

@ashishmahawal
Copy link

ashishmahawal commented Mar 18, 2022

hitting same issue
I ma having the exact same issue:
OS: macOS 12.2.1 (M1)
node: 16.14.0
npm: 8.5.3

@PaulRBerg PaulRBerg added the help wanted Extra attention is needed label Mar 18, 2022
@PaulRBerg
Copy link
Collaborator

Thanks everyone for reporting! Unfortunately I have never ever managed to reproduce this issue, even if I have very similar environments as you guys do.

Some help would be appreciated here. PRs welcome!

@kokokenada
Copy link

try touch yarn.lock as a work around yarnpkg/berry#625

@Praiz001
Copy link

Praiz001 commented May 6, 2022

I am having exact same error right now on Windows. Any fix yet ?

@adam-coster
Copy link

adam-coster commented Jan 12, 2023

I just ran into this on AWS CodeBuild (for CI), so it was also on a fresh install of everything. I cannot replicate it locally.

EDIT: I was able to replicate it locally by deleting all node_modules folders, .yarn/cache, and .yarn/install-state.gz.

  • Affected yarn v3.2.x and v3.3.1 (I had tried updating to resolve the issue, since that fixed it for someone else, to no avail).
  • The error message was for my root project.json, whose folder was also the working directory.
  • I got the error when I ran yarn node --version (which works locally for me)
  • I got the error when I ran any package.json script. In my case, the command was yarn ci:install
  • There was a yarn.lock file already, so that was not the problem.
  • I listed the files in all parent directories, all the way to /, and there were no package.json, yarn.lock, or other node/npm/yarn-related files in any parent.

✅ I resolved the issue by directly running my commands, instead of doing it through a package.json script.

Previously I had something like:

    // ...
    "scripts": {
        "ci:install":  "yarn workspaces focus root @myScope/package1 @myScope/package2"
    }
    // ...

And I was running the command yarn ci:install on the server. This caused the error to be thrown. By directly running the command yarn workspaces focus root @myScope/package1 @myScope/package2 I was able to avoid the error.

@adam-coster
Copy link

adam-coster commented Jan 12, 2023

To add onto my prior comment, I was able to confirm that the issue is:

When .yarn/install-state.gz is missing, yarn run ... fails and throws the error initially described in this issue.

This can be resolved by directly doing some sort of an install, without going through a package.json script. For example, yarn install for an entire repo or yarn workspaces focus ... for a subset of packages. Once any kind of install is directly run, the .yarn/install-state.gz file appears and future yarn run calls work as expected.

Note that the docs say that .yarn/install-state.gz should be gitignored, so this is presumably an unintended behavior.

My environment info:

  • Ubuntu 20 (via WSL2 on Windows 11)
  • Node 18.12.1
  • yarn 3.3.1 (via corepack)
  • Monorepo context

Relevant parts of my .yarnrc.yml:

nodeLinker: pnpm
plugins:
  - path: .yarn/plugins/@yarnpkg/plugin-version.cjs
    spec: '@yarnpkg/plugin-version'
  - path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
    spec: '@yarnpkg/plugin-workspace-tools'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

7 participants