npm run devができないです、、、
助けてください、、、
(以下、/Users/××/の箇所は削除してます)
環境
$ node -v v12.18.2 $ npm list webpack-cli /Applications/MAMP/htdocs/sample └─┬ laravel-mix@6.0.0 └── webpack-cli@4.2.0 $ npm list webpack /Applications/MAMP/htdocs/sample └─┬ laravel-mix@6.0.0 └── webpack@5.11.0 $ npm list vue /Applications/MAMP/htdocs/sample └── vue@3.0.4 $ php artisan -V Laravel Framework 8.14.0
package.jsonの中身
json
1 2{ 3 "private": true, 4 "scripts": { 5 "dev": "npm run development", 6 "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js", 7 "watch": "npm run development -- --watch", 8 "watch-poll": "npm run watch -- --watch-poll", 9 "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --disable-host-check --config=node_modules/laravel-mix/setup/webpack.config.js", 10 "prod": "npm run production", 11 "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --config=node_modules/laravel-mix/setup/webpack.config.js" 12 }, 13 "devDependencies": { 14 "@vue/compiler-sfc": "^3.0.2", 15 "axios": "^0.19", 16 "bootstrap": "^4.0.0", 17 "cross-env": "^7.0", 18 "jquery": "^3.2", 19 "laravel-mix": "^6.0.0-beta.14", 20 "laravel-mix-vue3": "^0.7.0", 21 "lodash": "^4.17.19", 22 "popper.js": "^1.12", 23 "postcss": "^8.1.10", 24 "resolve-url-loader": "^3.1.0", 25 "sass": "^1.20.1", 26 "sass-loader": "^8.0.0", 27 "vue": "^3.0.2", 28 "vue-loader": "^16.0.0-rc.2" 29 } 30}
エラー
$ npm run dev > @ dev /Applications/MAMP/htdocs/sample > npm run development > @ development /Applications/MAMP/htdocs/sample > cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js [webpack-cli] ReferenceError: File is not defined at /Applications/MAMP/htdocs/sample/node_modules/laravel-mix-vue3/index.js:63:44 at Array.map (<anonymous>) at Vue3.register (/Applications/MAMP/htdocs/sample/node_modules/laravel-mix-vue3/index.js:63:30) at Object.components.<computed> [as vue3] (/Applications/MAMP/htdocs/sample/node_modules/laravel-mix/src/components/ComponentRegistrar.js:117:53) at Object.<anonymous> (/Applications/MAMP/htdocs/sample/webpack.mix.js:3:5) at Module._compile (/Applications/MAMP/htdocs/sample/node_modules/v8-compile-cache/v8-compile-cache.js:192:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) at Module.load (internal/modules/cjs/loader.js:928:32) at Function.Module._load (internal/modules/cjs/loader.js:769:14) at Module.require (internal/modules/cjs/loader.js:952:19) npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js` npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the @ development 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! /.npm/_logs/2020-12-20T03_39_56_067Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! @ dev: `npm run development` npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the @ 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! /.npm/_logs/2020-12-20T03_39_56_529Z-debug.log
/.npm/_logs/2020-12-20T03_41_47_743Z-debug.log の中身
log
10 info it worked if it ends with ok 21 verbose cli [ 31 verbose cli '/.nodebrew/node/v14.15.1/bin/node', 41 verbose cli '/.nodebrew/current/bin/npm', 51 verbose cli 'run', 61 verbose cli 'dev' 71 verbose cli ] 82 info using npm@6.14.8 93 info using node@v14.15.1 104 verbose run-script [ 'predev', 'dev', 'postdev' ] 115 info lifecycle @~predev: @ 126 info lifecycle @~dev: @ 137 verbose lifecycle @~dev: unsafe-perm in lifecycle true 148 verbose lifecycle @~dev: PATH: /.nodebrew/node/v14.15.1/lib/node_modules/npm/node_modules/npm-lif ecycle/node-gyp-bin:/Applications/MAMP/htdocs/sample/node_modules/.bin:/.nodebrew/current/bin:/.npm-global/bin:/Applications/MAMP/Library/bin:/Applications/MAMP/conf:/:/Applications/M AMP/bin/php/php7.4.9/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Li brary/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands 159 verbose lifecycle @~dev: CWD: /Applications/MAMP/htdocs/sample 1610 silly lifecycle @~dev: Args: [ '-c', 'npm run development' ] 1711 silly lifecycle @~dev: Returned: code: 2 signal: null 1812 info lifecycle @~dev: Failed to exec dev script 1913 verbose stack Error: @ dev: `npm run development` 2013 verbose stack Exit status 2 2113 verbose stack at EventEmitter.<anonymous> (/.nodebrew/node/v14.15.1/lib/node_modules/npm/nod e_modules/npm-lifecycle/index.js:332:16) 2213 verbose stack at EventEmitter.emit (events.js:315:20) 2313 verbose stack at ChildProcess.<anonymous> (/.nodebrew/node/v14.15.1/lib/node_modules/npm/nod e_modules/npm-lifecycle/lib/spawn.js:55:14) 2413 verbose stack at ChildProcess.emit (events.js:315:20) 2513 verbose stack at maybeClose (internal/child_process.js:1048:16) 2613 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5) 2714 verbose pkgid @ 2815 verbose cwd /Applications/MAMP/htdocs/sample 2916 verbose Darwin 20.1.0 3017 verbose argv "/.nodebrew/node/v14.15.1/bin/node" "/.nodebrew/current/bin/npm" "run " "dev" 3118 verbose node v14.15.1 3219 verbose npm v6.14.8 3320 error code ELIFECYCLE 3421 error errno 2 3522 error @ dev: `npm run development` 3622 error Exit status 2 37
試したこと
・npmのアンインストール
rm -r node_modules rm package-lock.json npm cache clean --force npm install
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。