Open AxelBriche opened 3 years ago
Similar issue in the past https://github.com/nuxt/nuxt.js/issues/8015
I'm having same issue, with similar setup (typescript, ssr (though static), tailwind )
Just ran into this myself while updating dependencies.
Two steps were needed to fix this:
@nuxt/typescript-build
and @nuxt/typescript-runtime
to the latest versions as described in https://github.com/nuxt/nuxt.js/issues/8015package.json
) - currently it is set to ~4.2
.I have the same issue, but solved it by removing node_modules
and re-installed using yarn
instead of npm
. Somehow that worked!
When running npm run dev
on a newly-created Nuxt project (via npx) with Typescript support, I get this error:
This relative module was not found:
* ./index.vue?vue&type=script&lang=ts& in ./pages/index.vue
My global typescript version is 4.2 and my project's typescript version is also 4.2 (I also tried 4.5.5 for both). I manually installed @nuxt/typescript-runtime
but that didn't help.
Others are still having the same problem:
Various solutions are proposed:
None of those solutions worked for me. It seems to be an issue with TypeScript versions but it's not clear what the issue is.
My versions:
When I removed node_modules
and tried with yarn (1.22.17), the install completed correctly, and yarn run dev
did not show the error.
I got these errors on npm install
:
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: eslint-config-standard@16.0.3
npm WARN Found: eslint@8.9.0
npm WARN node_modules/eslint
npm WARN dev eslint@"^8.4.1" from the root project
npm WARN 18 more (@babel/eslint-parser, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer eslint@"^7.12.1" from eslint-config-standard@16.0.3
npm WARN node_modules/eslint-config-standard
npm WARN eslint-config-standard@"^16.0.3" from @nuxtjs/eslint-config@8.0.0
npm WARN node_modules/@nuxtjs/eslint-config
npm WARN
npm WARN Conflicting peer dependency: eslint@7.32.0
npm WARN node_modules/eslint
npm WARN peer eslint@"^7.12.1" from eslint-config-standard@16.0.3
npm WARN node_modules/eslint-config-standard
npm WARN eslint-config-standard@"^16.0.3" from @nuxtjs/eslint-config@8.0.0
npm WARN node_modules/@nuxtjs/eslint-config
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: eslint-plugin-promise@5.2.0
npm WARN Found: eslint@8.9.0
npm WARN node_modules/eslint
npm WARN dev eslint@"^8.4.1" from the root project
npm WARN 18 more (@babel/eslint-parser, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer eslint@"^7.0.0" from eslint-plugin-promise@5.2.0
npm WARN node_modules/eslint-plugin-promise
npm WARN eslint-plugin-promise@"^5.1.1" from @nuxtjs/eslint-config@8.0.0
npm WARN node_modules/@nuxtjs/eslint-config
npm WARN 1 more (eslint-config-standard)
npm WARN
npm WARN Conflicting peer dependency: eslint@7.32.0
npm WARN node_modules/eslint
npm WARN peer eslint@"^7.0.0" from eslint-plugin-promise@5.2.0
npm WARN node_modules/eslint-plugin-promise
npm WARN eslint-plugin-promise@"^5.1.1" from @nuxtjs/eslint-config@8.0.0
npm WARN node_modules/@nuxtjs/eslint-config
npm WARN 1 more (eslint-config-standard)
npm why typescript
gave this:
typescript@4.2.4 dev
node_modules/@nuxt/typescript-build/node_modules/typescript
typescript@"~4.2" from @nuxt/typescript-build@2.1.0
node_modules/@nuxt/typescript-build
dev @nuxt/typescript-build@"^2.1.0" from the root project
peer typescript@">= 2.7" from fork-ts-checker-webpack-plugin@6.5.0
node_modules/@nuxt/typescript-build/node_modules/fork-ts-checker-webpack-plugin
fork-ts-checker-webpack-plugin@"^6.1.1" from @nuxt/typescript-build@2.1.0
node_modules/@nuxt/typescript-build
dev @nuxt/typescript-build@"^2.1.0" from the root project
peer typescript@"*" from ts-loader@8.3.0
node_modules/@nuxt/typescript-build/node_modules/ts-loader
ts-loader@"^8.0.17" from @nuxt/typescript-build@2.1.0
node_modules/@nuxt/typescript-build
dev @nuxt/typescript-build@"^2.1.0" from the root project
typescript@4.5.5 dev
node_modules/typescript
typescript@"^4.4.3" from @commitlint/load@15.0.0
node_modules/@commitlint/load
@commitlint/load@"^15.0.0" from @commitlint/cli@15.0.0
node_modules/@commitlint/cli
dev @commitlint/cli@"^15.0.0" from the root project
peer typescript@">=3.8 <5.0" from ts-jest@27.1.3
node_modules/ts-jest
dev ts-jest@"^27.1.1" from the root project
peer typescript@">=2.7" from ts-node@9.1.1
node_modules/ts-node
ts-node@"^9" from @endemolshinegroup/cosmiconfig-typescript-loader@3.0.2
node_modules/@endemolshinegroup/cosmiconfig-typescript-loader
@endemolshinegroup/cosmiconfig-typescript-loader@"^3.0.2" from @commitlint/load@15.0.0
node_modules/@commitlint/load
@commitlint/load@"^15.0.0" from @commitlint/cli@15.0.0
node_modules/@commitlint/cli
dev @commitlint/cli@"^15.0.0" from the root project
peerOptional ts-node@">=9.0.0" from jest-config@27.5.1
node_modules/jest-config
jest-config@"^27.5.1" from @jest/core@27.5.1
node_modules/@jest/core
@jest/core@"^27.5.1" from jest@27.5.1
node_modules/jest
dev jest@"^27.4.4" from the root project
peer jest@"^27.0.0" from ts-jest@27.1.3
node_modules/ts-jest
dev ts-jest@"^27.1.1" from the root project
@jest/core@"^27.5.1" from jest-cli@27.5.1
node_modules/jest-cli
jest-cli@"^27.5.1" from jest@27.5.1
node_modules/jest
dev jest@"^27.4.4" from the root project
peer jest@"^27.0.0" from ts-jest@27.1.3
node_modules/ts-jest
dev ts-jest@"^27.1.1" from the root project
jest-config@"^27.5.1" from jest-cli@27.5.1
node_modules/jest-cli
jest-cli@"^27.5.1" from jest@27.5.1
node_modules/jest
dev jest@"^27.4.4" from the root project
peer jest@"^27.0.0" from ts-jest@27.1.3
node_modules/ts-jest
dev ts-jest@"^27.1.1" from the root project
peerOptional ts-node@">=9.0.0" from postcss-load-config@3.1.3
node_modules/tailwindcss/node_modules/postcss-load-config
postcss-load-config@"^3.1.0" from tailwindcss@2.2.19
node_modules/tailwindcss
tailwindcss@"^2.2.2" from @nuxtjs/tailwindcss@4.2.1
node_modules/@nuxtjs/tailwindcss
dev @nuxtjs/tailwindcss@"^4.2.1" from the root project
peer tailwindcss@"1 || 2 || 2.0.1-compat || 3" from tailwind-config-viewer@1.6.3
node_modules/tailwind-config-viewer
tailwind-config-viewer@"^1.6.2" from @nuxtjs/tailwindcss@4.2.1
node_modules/@nuxtjs/tailwindcss
dev @nuxtjs/tailwindcss@"^4.2.1" from the root project
peer typescript@">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" from tsutils@3.21.0
node_modules/tsutils
tsutils@"^3.21.0" from @typescript-eslint/eslint-plugin@5.12.0
node_modules/@typescript-eslint/eslint-plugin
@typescript-eslint/eslint-plugin@"^5.4.0" from @nuxtjs/eslint-config-typescript@8.0.0
node_modules/@nuxtjs/eslint-config-typescript
dev @nuxtjs/eslint-config-typescript@"^8.0.0" from the root project
peerOptional @typescript-eslint/eslint-plugin@"^4.0.0 || ^5.0.0" from eslint-plugin-jest@25.7.0
node_modules/eslint-plugin-jest
eslint-plugin-jest@"^25.3.0" from @nuxtjs/eslint-config@8.0.0
node_modules/@nuxtjs/eslint-config
@nuxtjs/eslint-config@"8.0.0" from @nuxtjs/eslint-config-typescript@8.0.0
node_modules/@nuxtjs/eslint-config-typescript
dev @nuxtjs/eslint-config-typescript@"^8.0.0" from the root project
tsutils@"^3.21.0" from @typescript-eslint/type-utils@5.12.0
node_modules/@typescript-eslint/type-utils
@typescript-eslint/type-utils@"5.12.0" from @typescript-eslint/eslint-plugin@5.12.0
node_modules/@typescript-eslint/eslint-plugin
@typescript-eslint/eslint-plugin@"^5.4.0" from @nuxtjs/eslint-config-typescript@8.0.0
node_modules/@nuxtjs/eslint-config-typescript
dev @nuxtjs/eslint-config-typescript@"^8.0.0" from the root project
peerOptional @typescript-eslint/eslint-plugin@"^4.0.0 || ^5.0.0" from eslint-plugin-jest@25.7.0
node_modules/eslint-plugin-jest
eslint-plugin-jest@"^25.3.0" from @nuxtjs/eslint-config@8.0.0
node_modules/@nuxtjs/eslint-config
@nuxtjs/eslint-config@"8.0.0" from @nuxtjs/eslint-config-typescript@8.0.0
node_modules/@nuxtjs/eslint-config-typescript
dev @nuxtjs/eslint-config-typescript@"^8.0.0" from the root project
tsutils@"^3.21.0" from @typescript-eslint/typescript-estree@5.12.0
node_modules/@typescript-eslint/typescript-estree
@typescript-eslint/typescript-estree@"5.12.0" from @typescript-eslint/parser@5.12.0
node_modules/@typescript-eslint/parser
@typescript-eslint/parser@"^5.4.0" from @nuxtjs/eslint-config-typescript@8.0.0
node_modules/@nuxtjs/eslint-config-typescript
dev @nuxtjs/eslint-config-typescript@"^8.0.0" from the root project
peer @typescript-eslint/parser@"^5.0.0" from @typescript-eslint/eslint-plugin@5.12.0
node_modules/@typescript-eslint/eslint-plugin
@typescript-eslint/eslint-plugin@"^5.4.0" from @nuxtjs/eslint-config-typescript@8.0.0
node_modules/@nuxtjs/eslint-config-typescript
dev @nuxtjs/eslint-config-typescript@"^8.0.0" from the root project
peerOptional @typescript-eslint/eslint-plugin@"^4.0.0 || ^5.0.0" from eslint-plugin-jest@25.7.0
node_modules/eslint-plugin-jest
eslint-plugin-jest@"^25.3.0" from @nuxtjs/eslint-config@8.0.0
node_modules/@nuxtjs/eslint-config
@nuxtjs/eslint-config@"8.0.0" from @nuxtjs/eslint-config-typescript@8.0.0
node_modules/@nuxtjs/eslint-config-typescript
dev @nuxtjs/eslint-config-typescript@"^8.0.0" from the root project
@typescript-eslint/typescript-estree@"5.12.0" from @typescript-eslint/utils@5.12.0
node_modules/@typescript-eslint/utils
@typescript-eslint/utils@"5.12.0" from @typescript-eslint/eslint-plugin@5.12.0
node_modules/@typescript-eslint/eslint-plugin
@typescript-eslint/eslint-plugin@"^5.4.0" from @nuxtjs/eslint-config-typescript@8.0.0
node_modules/@nuxtjs/eslint-config-typescript
dev @nuxtjs/eslint-config-typescript@"^8.0.0" from the root project
peerOptional @typescript-eslint/eslint-plugin@"^4.0.0 || ^5.0.0" from eslint-plugin-jest@25.7.0
node_modules/eslint-plugin-jest
eslint-plugin-jest@"^25.3.0" from @nuxtjs/eslint-config@8.0.0
node_modules/@nuxtjs/eslint-config
@nuxtjs/eslint-config@"8.0.0" from @nuxtjs/eslint-config-typescript@8.0.0
node_modules/@nuxtjs/eslint-config-typescript
dev @nuxtjs/eslint-config-typescript@"^8.0.0" from the root project
@typescript-eslint/utils@"5.12.0" from @typescript-eslint/experimental-utils@5.12.0
node_modules/@typescript-eslint/experimental-utils
@typescript-eslint/experimental-utils@"^5.0.0" from eslint-plugin-jest@25.7.0
node_modules/eslint-plugin-jest
eslint-plugin-jest@"^25.3.0" from @nuxtjs/eslint-config@8.0.0
node_modules/@nuxtjs/eslint-config
@nuxtjs/eslint-config@"8.0.0" from @nuxtjs/eslint-config-typescript@8.0.0
node_modules/@nuxtjs/eslint-config-typescript
dev @nuxtjs/eslint-config-typescript@"^8.0.0" from the root project
@typescript-eslint/utils@"5.12.0" from @typescript-eslint/type-utils@5.12.0
node_modules/@typescript-eslint/type-utils
@typescript-eslint/type-utils@"5.12.0" from @typescript-eslint/eslint-plugin@5.12.0
node_modules/@typescript-eslint/eslint-plugin
@typescript-eslint/eslint-plugin@"^5.4.0" from @nuxtjs/eslint-config-typescript@8.0.0
node_modules/@nuxtjs/eslint-config-typescript
dev @nuxtjs/eslint-config-typescript@"^8.0.0" from the root project
peerOptional @typescript-eslint/eslint-plugin@"^4.0.0 || ^5.0.0" from eslint-plugin-jest@25.7.0
node_modules/eslint-plugin-jest
eslint-plugin-jest@"^25.3.0" from @nuxtjs/eslint-config@8.0.0
node_modules/@nuxtjs/eslint-config
@nuxtjs/eslint-config@"8.0.0" from @nuxtjs/eslint-config-typescript@8.0.0
node_modules/@nuxtjs/eslint-config-typescript
dev @nuxtjs/eslint-config-typescript@"^8.0.0" from the root project
No errors when installing with yarn.
yarn why typescript
gives:
yarn why v1.22.17
[1/4] 🤔 Why do we have the module "typescript"...?
[2/4] 🚚 Initialising dependency graph...
[3/4] 🔍 Finding dependency...
[4/4] 🚡 Calculating file sizes...
=> Found "typescript@4.2.4"
info Reasons this module exists
- "@nuxt#typescript-build" depends on it
- Hoisted from "@nuxt#typescript-build#typescript"
info Disk size without dependencies: "57.14MB"
info Disk size with unique dependencies: "57.14MB"
info Disk size with transitive dependencies: "57.14MB"
info Number of shared dependencies: 0
=> Found "@commitlint/load#typescript@4.5.5"
info This module exists because "@commitlint#cli#@commitlint#load" depends on it.
info Disk size without dependencies: "61.75MB"
info Disk size with unique dependencies: "61.75MB"
info Disk size with transitive dependencies: "61.75MB"
info Number of shared dependencies: 0
✨ Done in 0.32s.
Using yarn to install worked for me as well. I have spent 8 hours today trying to get typescript going in Nuxt. Works fine if you just create a little project using "nuxt": "^2.15.8", "@nuxt/types": "^2.15.8", "@nuxt/typescript-build": "^2.1.0"
but the project I have was initially created with create-nuxt-app 4.0.0
. I experimented by just creating a new app with the tool, and using npm to install resulted in the relative module not found
or ts-loader
not found errors, but with yarn everything good.
Very frustrating lol.
npm 7.23.0
Hello, on a fresh new install: