create-eth-app
create-eth-app copied to clipboard
Failing build on fresh install: "package.json doesn't seem to have been installed"
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
-
yarn create eth-app my-eth-app
- 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: 89a9f219f210dde636e076fd2daa5882671e012b
terminal: iTerm2 3.4.14
user: no permission issues
I ma having the exact same issue:
OS: macOS 12.2.1 (M1)
node: 16.14.0
npm: 8.5.3
commit: 89a9f219f21
hitting same issue I ma having the exact same issue: OS: macOS 12.2.1 (M1) node: 16.14.0 npm: 8.5.3
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!
try touch yarn.lock
as a work around https://github.com/yarnpkg/berry/issues/625
I am having exact same error right now on Windows. Any fix yet ?
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
andv3.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 wasyarn 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 nopackage.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.
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'