Closed sakamoto-family-smile closed 3 weeks ago
$ npm install
$ npm run dev
↓
エラー
> chat-vrm@0.1.0 dev /Users/shotasakamoto/development/javascript/ChatVRM
> next dev
The module 'react' was not found. Next.js requires that you include it in 'dependencies' of your 'package.json'. To add it, run 'npm install react'
/Users/shotasakamoto/development/javascript/ChatVRM/node_modules/next/dist/cli/next-dev.js:362
showAll: args["--show-all"] ?? false,
^
SyntaxError: Unexpected token '?'
at wrapSafe (internal/modules/cjs/loader.js:891:16)
at Module._compile (internal/modules/cjs/loader.js:941:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1011:10)
at Module.load (internal/modules/cjs/loader.js:822:32)
at Function.Module._load (internal/modules/cjs/loader.js:730:14)
at Module.require (internal/modules/cjs/loader.js:864:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.dev (/Users/shotasakamoto/development/javascript/ChatVRM/node_modules/next/dist/lib/commands.js:10:30)
at Object.<anonymous> (/Users/shotasakamoto/development/javascript/ChatVRM/node_modules/next/dist/bin/next:141:28)
at Module._compile (internal/modules/cjs/loader.js:971:30)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! chat-vrm@0.1.0 dev: `next dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the chat-vrm@0.1.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/shotasakamoto/.npm/_logs/2024-10-19T04_12_25_733Z-debug.log
$ npm install react
↓
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @next/swc-darwin-arm64@13.2.4 (node_modules/@next/swc-darwin-arm64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @next/swc-darwin-arm64@13.2.4: wanted {"os":"darwin","arch":"arm64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @next/swc-freebsd-x64@13.2.4 (node_modules/@next/swc-freebsd-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @next/swc-freebsd-x64@13.2.4: wanted {"os":"freebsd","arch":"x64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @next/swc-android-arm64@13.2.4 (node_modules/@next/swc-android-arm64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @next/swc-android-arm64@13.2.4: wanted {"os":"android","arch":"arm64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @next/swc-linux-arm-gnueabihf@13.2.4 (node_modules/@next/swc-linux-arm-gnueabihf):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @next/swc-linux-arm-gnueabihf@13.2.4: wanted {"os":"linux","arch":"arm"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @next/swc-win32-ia32-msvc@13.2.4 (node_modules/@next/swc-win32-ia32-msvc):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @next/swc-win32-ia32-msvc@13.2.4: wanted {"os":"win32","arch":"ia32"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @next/swc-linux-arm64-gnu@13.2.4 (node_modules/@next/swc-linux-arm64-gnu):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @next/swc-linux-arm64-gnu@13.2.4: wanted {"os":"linux","arch":"arm64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @next/swc-android-arm-eabi@13.2.4 (node_modules/@next/swc-android-arm-eabi):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @next/swc-android-arm-eabi@13.2.4: wanted {"os":"android","arch":"arm"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @next/swc-linux-arm64-musl@13.2.4 (node_modules/@next/swc-linux-arm64-musl):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @next/swc-linux-arm64-musl@13.2.4: wanted {"os":"linux","arch":"arm64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @next/swc-win32-x64-msvc@13.2.4 (node_modules/@next/swc-win32-x64-msvc):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @next/swc-win32-x64-msvc@13.2.4: wanted {"os":"win32","arch":"x64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @next/swc-linux-x64-musl@13.2.4 (node_modules/@next/swc-linux-x64-musl):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @next/swc-linux-x64-musl@13.2.4: wanted {"os":"linux","arch":"x64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @next/swc-linux-x64-gnu@13.2.4 (node_modules/@next/swc-linux-x64-gnu):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @next/swc-linux-x64-gnu@13.2.4: wanted {"os":"linux","arch":"x64"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @next/swc-win32-arm64-msvc@13.2.4 (node_modules/@next/swc-win32-arm64-msvc):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @next/swc-win32-arm64-msvc@13.2.4: wanted {"os":"win32","arch":"arm64"} (current: {"os":"darwin","arch":"x64"})
+ react@18.2.0
updated 1 package and audited 375 packages in 11.895s
found 23 vulnerabilities (1 low, 12 moderate, 10 high)
run `npm audit fix` to fix them, or `npm audit` for details
再度、npm run devをしても、エラーになる。 ちゃんとログを見るか
以下のエラーがログに出てるが、よくわからん
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/Users/shotasakamoto/.nodebrew/node/v13.0.1/bin/node',
1 verbose cli '/Users/shotasakamoto/.nodebrew/current/bin/npm',
1 verbose cli 'run',
1 verbose cli 'dev'
1 verbose cli ]
2 info using npm@6.12.0
3 info using node@v13.0.1
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle chat-vrm@0.1.0~predev: chat-vrm@0.1.0
6 info lifecycle chat-vrm@0.1.0~dev: chat-vrm@0.1.0
7 verbose lifecycle chat-vrm@0.1.0~dev: unsafe-perm in lifecycle true
8 verbose lifecycle chat-vrm@0.1.0~dev: PATH: /Users/shotasakamoto/.nodebrew/node/v13.0.1/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/shotasakamoto/development/javascript/ChatVRM/node_modules/.bin:/Users/shotasakamoto/development/soft/google-cloud-sdk/bin:/Users/shotasakamoto/.nodebrew/current/bin:/Users/shotasakamoto/.rbenv/shims:/Users/shotasakamoto/.rbenv/bin:/Users/shotasakamoto/.gvm/bin:/Users/shotasakamoto/.gvm/bin:/Users/shotasakamoto/.pyenv/shims:/Users/shotasakamoto/.pyenv/bin:/Applications/CMake.app/Contents/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/go/bin:/bin:/Users/shotasakamoto/Library/Android/sdk/platform-tools:/Users/shotasakamoto/development/soft/kfctl:/Users/shotasakamoto/development/soft/kustomize:/Users/shotasakamoto/development/flutter/sdk/flutter/bin:/Users/shotasakamoto/.nodebrew/current/bin
9 verbose lifecycle chat-vrm@0.1.0~dev: CWD: /Users/shotasakamoto/development/javascript/ChatVRM
10 silly lifecycle chat-vrm@0.1.0~dev: Args: [ '-c', 'next dev' ]
11 silly lifecycle chat-vrm@0.1.0~dev: Returned: code: 1 signal: null
12 info lifecycle chat-vrm@0.1.0~dev: Failed to exec dev script
13 verbose stack Error: chat-vrm@0.1.0 dev: `next dev`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/Users/shotasakamoto/.nodebrew/node/v13.0.1/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:210:5)
13 verbose stack at ChildProcess.<anonymous> (/Users/shotasakamoto/.nodebrew/node/v13.0.1/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:210:5)
13 verbose stack at maybeClose (internal/child_process.js:1028:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid chat-vrm@0.1.0
15 verbose cwd /Users/shotasakamoto/development/javascript/ChatVRM
16 verbose Darwin 23.5.0
17 verbose argv "/Users/shotasakamoto/.nodebrew/node/v13.0.1/bin/node" "/Users/shotasakamoto/.nodebrew/current/bin/npm" "run" "dev"
18 verbose node v13.0.1
19 verbose npm v6.12.0
20 error code ELIFECYCLE
21 error errno 1
22 error chat-vrm@0.1.0 dev: `next dev`
22 error Exit status 1
23 error Failed at the chat-vrm@0.1.0 dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
~
nodeのバージョンが古すぎたの原因っぽい。 node13 -> 16にしたら、動いたっぽい。 nodeのrequired versionを確認すべき
package.jsonみると、下記の記載があるので、node16がよさそう
"engines": {
"node": "16.14.2"
}
ローカルで動くことを確認。
手順
readmeに書いている内容を試せば動いた。 ※nodeはpackage.jsonに書いてあるが、node 16を入れる必要がある