質問編集履歴
2
質問文の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,29 +2,69 @@
|
|
2
2
|
WSL2上のUbuntuでnpm run devコマンドを正常に実行する
|
3
3
|
|
4
4
|
### 発生している問題・分からないこと
|
5
|
+
ほんとに初学者で、質問も分かりにくくて申し訳ないです。前に、Laravelを使った簡易的なブログのアプリケーションをxamppで構築したのですが、それをDockerを使って動かしたいと思い、環境を構築しています。
|
6
|
+
wsl integrationの有効化は設定済みです。
|
7
|
+
今までUbuntuのターミナルで実行したコマンドは以下です。
|
8
|
+
docker run -it -v $(pwd):/opt -w /opt laravelsail/php81-composer:latest /bin/bash
|
9
|
+
composer create-project 'laravel/laravel:10.*' sail-example
|
10
|
+
cd sail-example
|
11
|
+
php artisan sail:install
|
12
|
+
exit
|
13
|
+
./vendor/bin/sail up -d
|
14
|
+
sudo chown -R ユーザー名:ユーザー名 .
|
15
|
+
./vendor/bin/sail php artisan key:generate
|
16
|
+
./vendor/bin/sail composer require laravel/ui
|
5
|
-
|
17
|
+
ここでディレクトリに対して適切な書き込み権限がないというエラーが出て、Linux ファイル システムのルート ディレクトリにファイルをコピーして作業再開しました。(それまでは、適当な位置にディレクトリを作って、/mnt/c/ディレクトリ名 のような感じで実行していました。)
|
18
|
+
./vendor/bin/sail artisan ui vue --auth
|
19
|
+
|
20
|
+
現在、Laravelのトップページが開けて、とphp my adminでデータベースを構築する準備ができている状態です。
|
21
|
+
|
22
|
+
|
23
|
+
package.jsonには以下のように書かれています。
|
24
|
+
```
|
25
|
+
{
|
26
|
+
"private": true,
|
27
|
+
"type": "module",
|
28
|
+
"scripts": {
|
29
|
+
"dev": "vite",
|
30
|
+
"build": "vite build"
|
31
|
+
},
|
32
|
+
"devDependencies": {
|
33
|
+
"@popperjs/core": "^2.11.6",
|
34
|
+
"@vitejs/plugin-vue": "^4.5.0",
|
35
|
+
"axios": "^1.6.4",
|
36
|
+
"bootstrap": "^5.2.3",
|
37
|
+
"laravel-vite-plugin": "^1.0.0",
|
38
|
+
"sass": "^1.56.1",
|
39
|
+
"vite": "^5.0.0",
|
40
|
+
"vue": "^3.2.37"
|
41
|
+
}
|
42
|
+
}
|
43
|
+
```
|
6
44
|
|
7
45
|
### エラーメッセージ
|
46
|
+
Ubuntuで、./vendor/bin/sail npm installと実行すると以下のようなエラーが出ます。
|
8
47
|
```error
|
48
|
+
root@LAPTOP-QSAVH99J:/home/kitano/sail-example# ./vendor/bin/sail npm install
|
9
|
-
npm
|
49
|
+
npm error code EACCES
|
10
|
-
npm ERR! path \\wsl.localhost\Ubuntu\home\kitano\sail-example\node_modules\esbuild
|
11
|
-
npm
|
50
|
+
npm error syscall mkdir
|
12
|
-
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node install.js
|
13
|
-
npm ERR! '\\wsl.localhost\Ubuntu\home\kitano\sail-example\node_modules\esbuild'
|
14
|
-
npm ERR! ��L�̌��݂̃f�B���N�g���� CMD.EXE ���J�n���܂����B
|
15
|
-
npm ERR! UNC �p�X�̓T�|�[�g����܂���BWindows �f�B���N�g��������Ŏg�p���܂��B
|
16
|
-
npm
|
51
|
+
npm error path /var/www/html/node_modules/@popperjs
|
52
|
+
npm error errno -13
|
53
|
+
npm error [Error: EACCES: permission denied, mkdir '/var/www/html/node_modules/@popperjs'] {
|
17
|
-
npm
|
54
|
+
npm error errno: -13,
|
18
|
-
npm ERR! ^
|
19
|
-
npm ERR!
|
20
|
-
npm ERR! Error: Cannot find module 'C:\Windows\install.js'
|
21
|
-
npm ERR! at Module._resolveFilename (node:internal/modules/cjs/loader:1143:15)
|
22
|
-
npm ERR! at Module._load (node:internal/modules/cjs/loader:984:27)
|
23
|
-
npm ERR! at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:142:12)
|
24
|
-
npm ERR! at node:internal/main/run_main_module:28:49 {
|
25
|
-
npm
|
55
|
+
npm error code: 'EACCES',
|
26
|
-
npm
|
56
|
+
npm error syscall: 'mkdir',
|
57
|
+
npm error path: '/var/www/html/node_modules/@popperjs'
|
27
|
-
npm
|
58
|
+
npm error }
|
59
|
+
npm error
|
60
|
+
npm error The operation was rejected by your operating system.
|
61
|
+
npm error It is likely you do not have the permissions to access this file as the current user
|
62
|
+
npm error
|
63
|
+
npm error If you believe this might be a permissions issue, please double-check the
|
64
|
+
npm error permissions of the file and its containing directories, or try running
|
65
|
+
npm error the command again as root/Administrator.
|
66
|
+
|
67
|
+
npm error A complete log of this run can be found in: /home/sail/.npm/_logs/2024-04-30T06_22_51_017Z-debug-0.log
|
28
68
|
|
29
69
|
```
|
30
70
|
|
1
Dockerを使用してるという情報を追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
WSL2上のUbuntuでnpm run devコマンドを正常に実行する
|
3
3
|
|
4
4
|
### 発生している問題・分からないこと
|
5
|
-
WSL2のUbuntu環境でnpm run devを実行しようとすると、esbuildのインストールエラーが発生しています。これが原因でnpm run devコマンドが実行できません。
|
5
|
+
WSL2のUbuntu環境でnpm run devを実行しようとすると、esbuildのインストールエラーが発生しています。これが原因でnpm run devコマンドが実行できません。この環境はDockerを使用しており、Dockerコンテナ内での作業が関連している可能性があります。
|
6
6
|
|
7
7
|
### エラーメッセージ
|
8
8
|
```error
|
@@ -45,4 +45,4 @@
|
|
45
45
|
npmのキャッシュをクリアしましたが、同じエラーが出続けています。
|
46
46
|
|
47
47
|
### 補足
|
48
|
-
WSL2を使用しているWindows 11の環境で発生しています。特に、esbuildのインストール中にWindowsのパスが参照されることが問題となっているようです。どのようにこの問題を解決すればよいか、具体的な手順を教えていただきたいです。
|
48
|
+
WSL2を使用しているWindows 11の環境で発生しています。特に、esbuildのインストール中にWindowsのパスが参照されることが問題となっているようです。また、この問題はDockerコンテナ内で発生しており、Dockerのセットアップや設定が関係している可能性があります。どのようにこの問題を解決すればよいか、具体的な手順を教えていただきたいです。
|