2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[備忘録]Nuxt3のRC版で「Cannot find module 'nuxt'」エラーが発生して動かなくなった

Posted at

Nuxt3のRC版を試してる際に以下のエラーが出るようになりましたが、解決できたので備忘録を残しておきます。

ERROR  Cannot start nuxt:  Cannot find module 'nuxt'

解決策

以下で解決できました。
https://github.com/nuxt/framework/discussions/3060#discussioncomment-2606906

実際に試した手順を記載しておきます。

①依存パッケージの定義方法を変更

package.json
{
  "devDependencies": {
    "nuxt": "npm:nuxt3@latest"
  }
}

②nuxt3をインポートしている個所の修正

nuxt.config.js
// 「from 'nuxt3'」から「from 'nuxt'」に変更
import { defineNuxtConfig } from 'nuxt'

export default defineNuxtConfig({ ... })

③いったん依存パッケージをすべて削除する

rm -rf node_modules
rm yarn.lock
rm package-lock.json

④再度依存パッケージをインストール

npm install
# or
yarn install
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?