2
0

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 1 year has passed since last update.

error Command "dev" not found.

Posted at

事象 : Nuxt.jsのプロジェクトを起動しようとしたら「devがみつからない」といわれた

$ yarn dev
yarn run v1.22.15
error Command "dev" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

原因 : package.jsonに定義がないから

これらのコマンドは package.json に記述する必要があります:

"scripts": {
  "dev": "nuxt",
  "build": "nuxt build",
  "start": "nuxt start",
  "generate": "nuxt generate"
}

次に yarn または npm run を介してコマンドを起動できます(例: yarn dev / npm run dev)。
Nuxt - コマンドと開発

なるほど、確かに自分のpackage.jsonに定義がない

{
  ; ...省略...
  "private": true,
  "scripts": {
    "build": "nuxt build",
    "start": "nuxt start",
    "generate": "nuxt generate",
  },
  "dependencies": {
  ; ...省略...

対応 : package.jsonに定義を追加する

  ; ...省略...
  "scripts": {
    "dev": "nuxt",
  ; ...省略...
動いた!
$ yarn dev
yarn run v1.22.15
$ nuxt

 WARN  sass-loader@12.4.0 is installed but ^10.1.1 is expected                                                                                       06:26:04


   ╭───────────────────────────────────────╮
   │                                       │
   │   Nuxt @ v2.15.8                      │
   │                                       │
2
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?