cohki0305 / SlackCloneApp

10 stars 5 forks source link

Messages.vueが取得できない #33

Open chigarashii opened 4 years ago

chigarashii commented 4 years ago

①聞きたいことの一行まとめ -Messages.vueに追記したらlocalhostで表示ができなくなった

②起きている問題(起きている現象の詳細/エラーメッセージ/スクリーンショット) エラーメッセージ

npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /Users/hoge/works/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/Users/hoge/works/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/hoge/.npm/_logs/2020-03-07T10_20_11_913Z-debug.log

③ソースコード(関連するソースコード/全ソースコード) index.vue

<template>
  <div class="container">
    <messages />
  </div>
</template>

<script>
import Messages from "~/components/Messages.vue";

export default {
  components: {
    Messages
  }
};
</script>

<style>
</style>

Messages.vue

<template>
  <div class="chats-container">
    <message />
    <message />
  </div>
</template>

<script>
import Message from "~/components/Message";

export default {
  components: {
    Message
  }
};
</script>

<style>
.chats-container {
  padding: 16px;
}
</style>

package.json

{
  "name": "slack-clone-app",
  "version": "1.0.0",
  "description": "My phenomenal Nuxt.js project",
  "author": "cohki0305",
  "private": true,
  "scripts": {
    "dev": "cross-env NODE_ENV=development nodemon server/index.js --watch server",
    "build": "nuxt build",
    "start": "cross-env NODE_ENV=production node server/index.js",
    "generate": "nuxt generate",
    "lint": "eslint --ext .js,.vue --ignore-path .gitignore ."
  },
  "dependencies": {
    "nuxt": "^2.0.0",
    "cross-env": "^5.2.0",
    "express": "^4.16.4"
  },
  "devDependencies": {
    "nodemon": "^1.18.9",
    "@nuxtjs/eslint-config": "^1.0.1",
    "@nuxtjs/eslint-module": "^1.0.0",
    "babel-eslint": "^10.0.1",
    "eslint": "^6.1.0",
    "eslint-plugin-nuxt": ">=0.4.2"
  }
}

④問題解決するために試したこと(コードもあれば追記) -index.vueとMessages.vueを見本に合わせて差分なしを確認 ⑤問題について自分なりに考えたこと(デバッグ結果/検索結果/自分なりの原因予想) -Messege.vueを追加するまで通常部描画されていたので、package.json周りの問題なのか

⑥当該コンテンツを購入したnoteのアカウント -nyama ⑦noteのどのあたりまでやったのか -1-3. slack風のUIを作成する --メッセージ入力欄を作成の前

cohki0305 commented 4 years ago

npm ERR! enoent ENOENT: no such file or directory, open '/Users/hoge/works/package.json'

って書いてるみたいなので、ディレクトリ間違っていたりしませんかね?

$ npm run dev

を実行するディレクトリが違うのではないかなって。

chigarashii commented 4 years ago

解決いたしました。 ありがとうございます。

ディレクトリ見直す癖付けします。