質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
npm

npmは、Node Packaged Modulesの略。Node.jsのライブラリ・パッケージを管理できるツールです。様々なモジュールを簡単にインストールでき、自分でモジュールを作成し公開する際にも使用できます。

docker-compose

docker-composeとは、複数のコンテナで構成されるサービスを提供する手順を自動的し管理を簡単にするツール。composeファイルを使用しコマンド1回で設定した全サービスを作成・起動することが可能です。

Nuxt.js

Nuxt.jsは、ユニバーサルなSPAが開発可能なVue.jsベースのフレームワーク。UIの描画サポートに特化しており、SSRにおけるサーバーサイドとクライアントサイドのUIレンダリングなどさまざまな機能を持ちます。

Docker

Dockerは、Docker社が開発したオープンソースのコンテナー管理ソフトウェアの1つです

Q&A

解決済

1回答

10089閲覧

npm ERR! code ELIFECYCLE の解決方法

nagi166

総合スコア23

npm

npmは、Node Packaged Modulesの略。Node.jsのライブラリ・パッケージを管理できるツールです。様々なモジュールを簡単にインストールでき、自分でモジュールを作成し公開する際にも使用できます。

docker-compose

docker-composeとは、複数のコンテナで構成されるサービスを提供する手順を自動的し管理を簡単にするツール。composeファイルを使用しコマンド1回で設定した全サービスを作成・起動することが可能です。

Nuxt.js

Nuxt.jsは、ユニバーサルなSPAが開発可能なVue.jsベースのフレームワーク。UIの描画サポートに特化しており、SSRにおけるサーバーサイドとクライアントサイドのUIレンダリングなどさまざまな機能を持ちます。

Docker

Dockerは、Docker社が開発したオープンソースのコンテナー管理ソフトウェアの1つです

0グッド

0クリップ

投稿2020/09/17 02:06

前提・実現したいこと

nuxtのコンテナを立ち上げる時(というよりnpm run devをした時)エラーが起こります。

発生している問題・エラーメッセージ

USER1 tool % docker-compose up nuxt Recreating nuxt_1 ... done Attaching to nuxt_1 nuxt_1 | nuxt_1 | > nuxt@2.14.0 postinstall /project/app/node_modules/nuxt nuxt_1 | > opencollective || exit 0 nuxt_1 | nuxt_1 | sh: 1: opencollective: not found nuxt_1 | npm WARN eslint-plugin-vue@6.2.2 requires a peer of eslint@^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself. nuxt_1 | nuxt_1 | added 141 packages from 71 contributors, removed 307 packages, updated 194 packages and audited 2082 packages in 130.485s nuxt_1 | nuxt_1 | 68 packages are looking for funding nuxt_1 | run `npm fund` for details nuxt_1 | nuxt_1 | found 5 vulnerabilities (3 low, 2 high) nuxt_1 | run `npm audit fix` to fix them, or `npm audit` for details nuxt_1 | nuxt_1 | > tool@1.0.0 dev /project/app nuxt_1 | > nuxt-ts nuxt_1 | nuxt_1 | sh: 1: nuxt-ts: not found nuxt_1 | npm ERR! code ELIFECYCLE nuxt_1 | npm ERR! syscall spawn nuxt_1 | npm ERR! file sh nuxt_1 | npm ERR! errno ENOENT nuxt_1 | npm ERR! tool@1.0.0 dev: `nuxt-ts` nuxt_1 | npm ERR! spawn ENOENT nuxt_1 | npm ERR! nuxt_1 | npm ERR! Failed at the tool@1.0.0 dev script. nuxt_1 | npm ERR! This is probably not a problem with npm. There is likely additional logging output above. nuxt_1 | nuxt_1 | npm ERR! A complete log of this run can be found in: nuxt_1 | npm ERR! /root/.npm/_logs/2020-09

該当のソースコード

[docker-compose.yml]

yaml

1version: '3' 2services: 3 nuxt: 4 build: ./nuxt 5 volumes: 6 - ./nuxt:/project 7 working_dir: /project/app 8 command: bash -c "npm install && npm run dev" 9 ports: 10 - 3000:3000

試したこと

docker-compose.ymlをcommand: bash -c "npm install && npm audit fix && npm run dev"にしてdocker-compose up nuxt
[ターミナル]

USER1 tool % docker-compose up nuxt Recreating nuxt_1 ... done Attaching to pnuxt_1 nuxt_1 | npm WARN eslint-plugin-vue@6.2.2 requires a peer of eslint@^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself. nuxt_1 | nuxt_1 | audited 2082 packages in 23.657s nuxt_1 | nuxt_1 | 74 packages are looking for funding nuxt_1 | run `npm fund` for details nuxt_1 | nuxt_1 | found 5 vulnerabilities (3 low, 2 high) nuxt_1 | run `npm audit fix` to fix them, or `npm audit` for details nuxt_1 | npm WARN eslint-plugin-vue@6.2.2 requires a peer of eslint@^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself. nuxt_1 | nuxt_1 | updated 3 packages in 23.433s nuxt_1 | nuxt_1 | 74 packages are looking for funding nuxt_1 | run `npm fund` for details nuxt_1 | nuxt_1 | fixed 5 of 5 vulnerabilities in 2082 scanned packages nuxt_1 | nuxt_1 | > learning_tool@1.0.0 dev /project/app nuxt_1 | > nuxt-ts nuxt_1 | nuxt_1 | sh: 1: nuxt-ts: not found nuxt_1 | npm ERR! code ELIFECYCLE nuxt_1 | npm ERR! syscall spawn nuxt_1 | npm ERR! file sh nuxt_1 | npm ERR! errno ENOENT nuxt_1 | npm ERR! learning_tool@1.0.0 dev: `nuxt-ts` nuxt_1 | npm ERR! spawn ENOENT nuxt_1 | npm ERR! nuxt_1 | npm ERR! Failed at the learning_tool@1.0.0 dev script. nuxt_1 | npm ERR! This is probably not a problem with npm. There is likely additional logging output above. nuxt_1 | nuxt_1 | npm ERR! A complete log of this run can be found in: nuxt_1 | npm ERR! /root/.npm/_logs/2020-09-17T01_59_22_998Z-debug.log nuxt_1 exited with code 1

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

エラーの原因は次の箇所です

console

1nuxt_1 | sh: 1: nuxt-ts: not found

ホストの .nuxt/app/node_modules/.bin 配下に nuxt-ts が存在するか確認します

存在しない場合は npm install でインストールされていないことになるので、
pacakge.json に nuxt-ts が存在するかを確認します

nuxt-ts - npm

投稿2020/09/17 02:30

y_shinoda

総合スコア3272

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

nagi166

2020/09/17 02:50 編集

package.jsonはこうでした ``` { "name": "tool", "version": "1.0.0", "private": true, "scripts": { "dev": "nuxt-ts", "build": "nuxt-ts build", "start": "nuxt-ts start", "generate": "nuxt-ts generate", "lint:js": "eslint --ext .js,.ts,.vue --ignore-path .gitignore .", "lint": "npm run lint:js", "test": "jest" }, "dependencies": { "@nuxt/typescript-runtime": "^1.0.0", "@nuxtjs/axios": "^5.12.0", "@types/jest": "^26.0.13", "axios": "^0.20.0", "axios-mock-server": "^0.19.0", "babel-plugin-transform-decorators": "^6.24.1", "flush-promises": "^1.0.2", "nuxt": "^2.14.0", "nuxt-class-component": "^1.3.0", "nuxt-property-decorator": "^2.7.2", "vue-class-component": "^7.2.5", "vue-property-decorator": "^9.0.0", "vuex-module-decorators": "^0.17.0" }, "devDependencies": { "@nuxt/types": "^2.14.0", "@nuxt/typescript-build": "^2.0.2", "@nuxtjs/eslint-config": "^3.1.0", "@nuxtjs/eslint-config-typescript": "^3.0.0", "@nuxtjs/eslint-module": "^2.0.0", "@nuxtjs/style-resources": "^1.0.0", "@nuxtjs/vuetify": "^1.11.2", "@vue/test-utils": "^1.0.3", "babel-core": "7.0.0-bridge.0", "babel-eslint": "^10.1.0", "babel-jest": "^26.1.0", "eslint": "^7.5.0", "eslint-config-prettier": "^6.11.0", "eslint-plugin-nuxt": "^1.0.0", "eslint-plugin-prettier": "^3.1.4", "jest": "^26.1.0", "js-cookie": "^2.2.1", "node-sass": "^4.14.1", "prettier": "^2.0.5", "sass-loader": "^7.1.0", "ts-jest": "^26.1.3", "vue-jest": "^3.0.4", "vuex-persistedstate": "^3.1.0" } } ```
y_shinoda

2020/09/17 02:55

回答欄のリンク先にある通り npm コマンドでインストールして package.json を更新しましょう npm i nuxt-ts
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問