I ran into a snag a month or two ago while updating NPM, and I had to revert to the version I was using originally. I thought I got it all figured out, but clearly I didn’t as you’re about to see.
At the time this occurred, I was paused on my first Turborepo project (a work project, but I work from home so it’s all on a single machine), so I didn’t check to see how it had been impacted. Now I’m finding the mess, and I’m not sure how to fix it.
When executing turbo dev at the root of the repo, I get several errors, the first of which is this:
WARNING Issues occurred when constructing package graph. Turbo will function, but some features may not be available:
× Could not resolve workspaces.
├─▶ Unable to convert from json: missing field `packages` at line 68 column 1
╰─▶ missing field `packages` at line 68 column 1
Aside from the NPM mess I made, I didn’t change anything else in my Turborepo setup. I’m not sure where to locate “line 68 column 1” to try and fix this, as it didn’t list a filename with that error.
FWIW I’m pretty comfortable coding apps, but I’m not the best at doing stuff in the terminal (as evidenced by the NPM mess I made), so please be patient with me.
Does anyone have an idea on how to address this? If not, I’ll probably just start from scratch with a new project and copy over existing code in chunks. Not sure what else to do.
I may be able to do that, but at this point I’m feeling like starting over might be a more effective use of my time on this particular project. I’ve got to significantly rework some other stuff anyway (converting the lone app so far from Remix to React Router v7), and doing that in a broken repo isn’t going to make that process any easier. I’ll just chalk this up to massive user error, start from the ground up, and be a lot more careful going forward.
Sorry for reopening this, but my attempt at starting from scratch is failing in virtually the same way. Here’s what I did after completely deleting the entire repo contents (yes, I have a backup):
Ran npx create-turbo@latest. That built a default Turbo project without any issues.
Ran npm i to install dependencies. Again, no issues.
Ran npm install turbo --save-dev. Still no issues.
Tried to run turbo dev and I get the same error that I reported at the start of this thread, only now it’s saying the error is on line 75 instead of 68. I still can’t figure out which file it’s referring to, as none of the json files I’ve reviewed have that many lines.
For reference, I’m running NPM v6.14.8, Node 21.7.3, and Turbo 2.4.2
If it’ll help, here’s the full error log. The error I reported at the start of the thread was just one of many, and I thought that if I could figure out how to fix it, the rest would settle themselves, but perhaps not.
turbo 2.4.2
WARNING Issues occurred when constructing package graph. Turbo will function, but some features may not be available:
× Could not resolve workspaces.
├─▶ Unable to convert from json: missing field `packages` at line 75 column 1
╰─▶ missing field `packages` at line 75 column 1
• Packages in scope: @repo/eslint-config, @repo/typescript-config, @repo/ui, docs, web
• Running dev in 5 packages
• Remote caching disabled
┌ web#dev > cache bypass, force executing 4d5346c99fed5ad1
│
│ > web@0.1.0 dev /Users/justinbarrett/Documents/dev/lightsOverAtlanta/apps/loa-portal/apps/web
│ > next dev --turbopack --port 3000
│
│ sh: next: command not found
│ npm ERR! code ELIFECYCLE
│ npm ERR! syscall spawn
│ npm ERR! file sh
│ npm ERR! errno ENOENT
│ npm ERR! web@0.1.0 dev: `next dev --turbopack --port 3000`
│ npm ERR! spawn ENOENT
│ npm ERR!
│ npm ERR! Failed at the web@0.1.0 dev script.
│ npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
│ npm WARN Local package.json exists, but node_modules missing, did you mean to install?
│
│ npm ERR! A complete log of this run can be found in:
│ npm ERR! /Users/justinbarrett/.npm/_logs/2025-02-17T20_26_20_827Z-debug.log
└────>
┌ docs#dev > cache bypass, force executing 2442233c5da31d2b
│
│ > docs@0.1.0 dev /Users/justinbarrett/Documents/dev/lightsOverAtlanta/apps/loa-portal/apps/docs
│ > next dev --turbopack --port 3001
│
│ sh: next: command not found
│ npm ERR! code ELIFECYCLE
│ npm ERR! syscall spawn
│ npm ERR! file sh
│ npm ERR! errno ENOENT
│ npm ERR! docs@0.1.0 dev: `next dev --turbopack --port 3001`
│ npm ERR! spawn ENOENT
│ npm ERR!
│ npm ERR! Failed at the docs@0.1.0 dev script.
│ npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
│ npm WARN Local package.json exists, but node_modules missing, did you mean to install?
│
│ npm ERR! A complete log of this run can be found in:
│ npm ERR! /Users/justinbarrett/.npm/_logs/2025-02-17T20_26_20_827Z-debug.log
│
│ command finished with error: command (/Users/justinbarrett/Documents/dev/lightsOverAtlanta/apps/loa-portal/apps/docs) /Users/justinbarrett/.nvm/versio
│ ns/node/v21.7.3/bin/npm run dev exited (1)
└────>
docs#dev: command (/Users/justinbarrett/Documents/dev/lightsOverAtlanta/apps/loa-portal/apps/docs) /Users/justinbarrett/.nvm/versions/node/v21.7.3/bin/npm run dev exited (1)
Tasks: 0 successful, 2 total
Cached: 0 cached, 2 total
Time: 512ms
Failed: docs#dev
ERROR run failed: command exited (1)
Any insights you could offer would be greatly appreciated.
On a whim I just tried starting a new example Turbo project in a brand new folder, thinking that maybe my old folder might have something that was messing up the process. Still got the same errors as I last posted above.
Checking the “Support policy” page of the Turbo docs, it says that Turbo supports npm 8+. I could’ve sworn that 6.14.8 was the version I was running before things blew up. However, digging back into earlier commits of the project repo where this all began, the package.json file in my last good commit lists the “packageManager” as “npm@10.5.2”.
I installed npm 10.5.2, then ran npm i in the example project folder. Once that was done, I ran turbo dev and…it worked!
Sorry for all of this mess. Clearly I have a lot to learn when it comes to command line tools.
Hey Justin! I’m really happy you got an answer in the end, thank you for coming back and sharing. Hopefully it helps anyone else that stumbles upon a similar issue