question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TS5083: Cannot read file '.nuxt/tsconfig.json' on npm run build

See original GitHub issue

I have been struggling after migration from Nuxt 2.x.x to Nuxt 3. When running npm run buildI got the following error.

TS5083: Cannot read file '/opt/build/repo/.nuxt/tsconfig.json'.
error TS5083: Cannot read file '.nuxt/tsconfig.json'.

At first glace I thought this only might happen on Netlify builds, so I asked here

App on Netlify https://courageous-fox-6869a5.netlify.app

Code on Github https://github.com/p3t3r67x0/nuxt-rc-netlify

Issue on Build I have been trying to find any fix but more than two days has gone without a good glue…

My guess is now that the "extends": "./.nuxt/tsconfig.json" command in the .tsconfig.json in project root seems to be not correctly read by the package ts-node which was required as peer dependency by the package nuxt-graphql-client.

ts-node package is located under /node_modules/** and probably accessing tsconfig.json which is not the same directory.

Logs from Build

12:04:34 AM: Build ready to start
12:04:40 AM: build-image version: 9289b698a503f132b265bd089ab40ce1d6f9e65e (focal)
12:04:40 AM: build-image tag: v4.12.0
12:04:40 AM: buildbot version: c87074660cd9a4568c0ac759bc083987e94204b3
12:04:40 AM: Fetching cached dependencies
12:04:40 AM: Starting to download cache of 124.1MB
12:04:41 AM: Finished downloading cache in 995.987837ms
12:04:41 AM: Starting to extract cache
12:04:43 AM: Finished extracting cache in 2.41548443s
12:04:43 AM: Finished fetching cache in 3.464243781s
12:04:43 AM: Starting to prepare the repo for build
12:04:44 AM: Preparing Git Reference refs/heads/master
12:04:44 AM: Parsing package.json dependencies
12:04:44 AM: Different build dir detected, going to use the one specified in the Netlify configuration file: '' versus '/opt/build/repo/' in the Netlify UI
12:04:44 AM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'dist' versus '.output/' in the Netlify UI
12:04:44 AM: Different build command detected, going to use the one specified in the Netlify configuration file: 'npx pnpm install --shamefully-hoist --store=node_modules/.pnpm-store --frozen-lockfile && npm run build' versus '' in the Netlify UI
12:04:44 AM: Starting build script
12:04:44 AM: Installing dependencies
12:04:44 AM: Python version set to 2.7
12:04:44 AM: Started restoring cached node version
12:04:45 AM: Finished restoring cached node version
12:04:45 AM: v16.17.1 is already installed.
12:04:46 AM: Now using node v16.17.1 (npm v8.15.0)
12:04:46 AM: Started restoring cached build plugins
12:04:46 AM: Finished restoring cached build plugins
12:04:46 AM: Attempting ruby version 2.7.2, read from environment
12:04:46 AM: Using ruby version 2.7.2
12:04:47 AM: Using PHP version 8.0
12:04:47 AM: No npm workspaces detected
12:04:47 AM: Started restoring cached node modules
12:04:47 AM: Finished restoring cached node modules
12:04:47 AM: Installing NPM modules using NPM version 8.15.0
12:04:47 AM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
12:04:47 AM: npm WARN config location in the cache, and they are managed by
12:04:47 AM: npm WARN config     [`cacache`](http://npm.im/cacache).
12:04:47 AM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
12:04:47 AM: npm WARN config location in the cache, and they are managed by
12:04:47 AM: npm WARN config     [`cacache`](http://npm.im/cacache).
12:04:47 AM: 8.15.0
12:04:47 AM: NPM modules installed
12:04:48 AM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
12:04:48 AM: npm WARN config location in the cache, and they are managed by
12:04:48 AM: npm WARN config     [`cacache`](http://npm.im/cacache).
12:04:48 AM: Started restoring cached go cache
12:04:48 AM: Finished restoring cached go cache
12:04:48 AM: Installing Go version 1.17 (requested 1.17)
12:04:52 AM: unset GOOS;
12:04:52 AM: unset GOARCH;
12:04:52 AM: export GOROOT='/opt/buildhome/.gimme/versions/go1.17.linux.amd64';
12:04:52 AM: export PATH="/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}";
12:04:52 AM: go version >&2;
12:04:52 AM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.17.linux.amd64.env"
12:04:52 AM: go version go1.17 linux/amd64
12:04:52 AM: Installing missing commands
12:04:52 AM: Verify run directory
12:04:53 AM: ​
12:04:53 AM: ────────────────────────────────────────────────────────────────
12:04:53 AM:   Netlify Build                                                 
12:04:53 AM: ────────────────────────────────────────────────────────────────
12:04:53 AM: ​
12:04:53 AM: ❯ Version
12:04:53 AM:   @netlify/build 27.20.1
12:04:53 AM: ​
12:04:53 AM: ❯ Flags
12:04:53 AM:   baseRelDir: true
12:04:53 AM:   buildId: 63434572c170450009cc60b5
12:04:53 AM:   deployId: 63434572c170450009cc60b7
12:04:53 AM: ​
12:04:53 AM: ❯ Current directory
12:04:53 AM:   /opt/build/repo
12:04:53 AM: ​
12:04:53 AM: ❯ Config file
12:04:53 AM:   /opt/build/repo/netlify.toml
12:04:53 AM: ​
12:04:53 AM: ❯ Context
12:04:53 AM:   production
12:04:53 AM: ​
12:04:53 AM: ────────────────────────────────────────────────────────────────
12:04:53 AM:   1. build.command from netlify.toml                            
12:04:53 AM: ────────────────────────────────────────────────────────────────
12:04:53 AM: ​
12:04:53 AM: $ npx pnpm install --shamefully-hoist --store=node_modules/.pnpm-store --frozen-lockfile && npm run build
12:04:54 AM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
12:04:54 AM: npm WARN config location in the cache, and they are managed by
12:04:54 AM: npm WARN config     [`cacache`](http://npm.im/cacache).
12:04:56 AM: npm WARN exec The following package was not found and will be installed: pnpm@7.13.3
12:04:57 AM: Lockfile is up to date, resolution step is skipped
12:04:57 AM: Progress: resolved 1, reused 0, downloaded 0, added 0
12:04:57 AM: Packages: +12
12:04:57 AM: ++++++++++++
12:04:58 AM: Progress: resolved 12, reused 2, downloaded 10, added 10, done
12:04:58 AM: dependencies:
12:04:58 AM: + vue-tsc 1.0.2
12:04:58 AM: > @ postinstall /opt/build/repo
12:04:58 AM: > nuxt prepare
12:04:58 AM: [log] Nuxi 3.0.0-rc.11
12:04:59 AM: [info] [nuxt:tailwindcss] Using default Tailwind CSS file from runtime/tailwind.css
12:05:00 AM: [error] β¨― Unable to compile TypeScript:
12:05:00 AM: error TS5083: Cannot read file '/opt/build/repo/.nuxt/tsconfig.json'.
12:05:00 AM:   error TS5083: Cannot read file '.nuxt/tsconfig.json'.
12:05:00 AM:   at createTSError (node_modules/.pnpm/ts-node@10.9.1_xtdkmayvpbwqd3kc4kczaw2zvm/node_modules/ts-node/src/index.ts:859:12)
12:05:00 AM:   at reportTSError (node_modules/.pnpm/ts-node@10.9.1_xtdkmayvpbwqd3kc4kczaw2zvm/node_modules/ts-node/src/index.ts:863:19)
12:05:00 AM:   at createFromPreloadedConfig (node_modules/.pnpm/ts-node@10.9.1_xtdkmayvpbwqd3kc4kczaw2zvm/node_modules/ts-node/src/index.ts:874:36)
12:05:00 AM:   at create (node_modules/.pnpm/ts-node@10.9.1_xtdkmayvpbwqd3kc4kczaw2zvm/node_modules/ts-node/src/index.ts:624:10)
12:05:00 AM:   at register (node_modules/.pnpm/ts-node@10.9.1_xtdkmayvpbwqd3kc4kczaw2zvm/node_modules/ts-node/src/index.ts:591:15)
12:05:00 AM:   at TypeScriptLoader (node_modules/.pnpm/cosmiconfig-typescript-loader@4.1.1_mwz2f5nk5qxm3a6zkoxfkps5ya/node_modules/cosmiconfig-typescript-loader/dist/cjs/index.js:52:54)
12:05:00 AM:   at node_modules/.pnpm/@graphql-codegen+cli@2.13.5_bcskau5n4us7t7edj5bgrx4upa/node_modules/@graphql-codegen/cli/esm/config.js:16:18
12:05:00 AM:   at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
12:05:00 AM:   at async Promise.all (index 0)
12:05:00 AM:   at async ESMLoader.import (node:internal/modules/esm/loader:533:24)
12:05:00 AM:   at async normalizeModule (node_modules/.pnpm/@nuxt+kit@3.0.0-rc.11/node_modules/@nuxt/kit/dist/index.mjs:476:26)
12:05:00 AM:   at async installModule (node_modules/.pnpm/@nuxt+kit@3.0.0-rc.11/node_modules/@nuxt/kit/dist/index.mjs:455:41)
12:05:00 AM:   at async initNuxt (node_modules/.pnpm/nuxt@3.0.0-rc.11_typescript@4.8.4/node_modules/nuxt/dist/index.mjs:1606:7)
12:05:00 AM:   at async loadNuxt (node_modules/.pnpm/nuxt@3.0.0-rc.11_typescript@4.8.4/node_modules/nuxt/dist/index.mjs:1635:5)
12:05:00 AM:   at async loadNuxt (node_modules/.pnpm/@nuxt+kit@3.0.0-rc.11/node_modules/@nuxt/kit/dist/index.mjs:732:19)
12:05:00 AM:   at async Object.invoke (node_modules/.pnpm/nuxi@3.0.0-rc.11/node_modules/nuxi/dist/chunks/prepare.mjs:30:18)
12:05:00 AM:   at async _main (node_modules/.pnpm/nuxi@3.0.0-rc.11/node_modules/nuxi/dist/cli.mjs:50:20)
12:05:00 AM:  ELIFECYCLE  Command failed with exit code 1. (https://ntl.fyi/exit-code-1)
12:05:00 AM: ​
12:05:00 AM: ────────────────────────────────────────────────────────────────
12:05:00 AM:   "build.command" failed                                        
12:05:00 AM: ────────────────────────────────────────────────────────────────
12:05:00 AM: ​
12:05:00 AM:   Error message
12:05:00 AM:   Command failed with exit code 1: npx pnpm install --shamefully-hoist --store=node_modules/.pnpm-store --frozen-lockfile && npm run build (https://ntl.fyi/exit-code-1)
12:05:00 AM: ​
12:05:00 AM:   Error location
12:05:00 AM:   In build.command from netlify.toml:
12:05:00 AM:   npx pnpm install --shamefully-hoist --store=node_modules/.pnpm-store --frozen-lockfile && npm run build
12:05:00 AM: ​
12:05:00 AM:   Resolved config
12:05:00 AM:   build:
12:05:00 AM:     base: /opt/build/repo
12:05:00 AM:     command: npx pnpm install --shamefully-hoist --store=node_modules/.pnpm-store --frozen-lockfile && npm run build
12:05:00 AM:     commandOrigin: config
12:05:00 AM:     environment:
12:05:00 AM:       - NPM_FLAGS
12:05:00 AM:     publish: /opt/build/repo/dist
12:05:00 AM:     publishOrigin: config
12:05:00 AM: Caching artifacts
12:05:00 AM: Started saving node modules
12:05:00 AM: Finished saving node modules
12:05:00 AM: Started saving build plugins
12:05:00 AM: Finished saving build plugins
12:05:00 AM: Started saving pip cache
12:05:00 AM: Finished saving pip cache
12:05:00 AM: Started saving emacs cask dependencies
12:05:00 AM: Finished saving emacs cask dependencies
12:05:00 AM: Started saving maven dependencies
12:05:00 AM: Finished saving maven dependencies
12:05:00 AM: Started saving boot dependencies
12:05:00 AM: Finished saving boot dependencies
12:05:00 AM: Started saving rust rustup cache
12:05:00 AM: Finished saving rust rustup cache
12:05:00 AM: Started saving go dependencies
12:05:00 AM: Finished saving go dependencies
12:05:00 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:05:00 AM: Creating deploy upload records
12:05:00 AM: Failing build: Failed to build site
12:05:00 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
12:05:00 AM: Finished processing build request in 20.606506564s

I am thankful for any advise.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
itzakscommented, Oct 10, 2022

This error suddenly started appearing at our end too, deploying on netlify with Nuxt 3 rc-11. Also running nuxt-graphql-client.

Currently working by removing tsconfig.json from root and moving the config into nuxt.config.ts under typescript.tsConfig.

1reaction
danielroecommented, Oct 25, 2022

Seems the issue to track is https://github.com/Diizzayy/nuxt-graphql-client/issues/218. Note there is a fix in 0.1.23.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues - GitHub
I have got a similar issue where my build fails due to this error TS5083: Cannot read file '.nuxt/tsconfig.json' but using Nuxt 3....
Read more >
error TS5083: Cannot read file '/tsconfig.json' - Stack Overflow
I am trying to run the command "tscΒ ...
Read more >
Nuxt 3 build logs "unable to compile TypeScript" - Support
error TS5083: Cannot read file '.nuxt/tsconfig.json'. this is how my tsconfig.json looks like { "extends": "./.nuxt/tsconfig.json", "compilerOptions":Β ...
Read more >
Parsing Error: Cannot read file 'tsconfig.json' | bobbyhadz
project" has been set for @typescript-eslint/parser error, create a tsconfig.eslint.json file in your root directory, right next to your tsconfig.json file.
Read more >
Setup - Nuxt TypeScript
Nuxt TypeScript Support mainly comes through a Nuxt module, @nuxt/typescript-build, and its types @nuxt/types. Here are the guidelines to installΒ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found