簡體   English   中英

npm install && npm run dev 在 laravel 中不工作

[英]npm install && npm run dev isnt working in laravel

嗨,我只是安裝了 node.js 並嘗試在 laravel 8 中運行這個命令

npm 安裝 && npm 運行開發

(注意:我在 D: 安裝 node.js)這是完整的安裝

paste.ofcode.org/ZC8e7KP6v7gYrAxqHBFjpk

但它給出了這個錯誤:

  npm ERR! code ELIFECYCLE
  npm ERR! errno 1
  npm ERR! @ development: `mix`
  npm ERR! Exit status 1
  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!     C:\Users\john\AppData\Roaming\npm-cache\_logs
  \2021-04-24T07_04_58_823Z-debug.log
  npm ERR! code ELIFECYCLE
  npm ERR! errno 1
  npm ERR! @ dev: `npm run development`
  npm ERR! Exit status 1
  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!     C:\Users\john\AppData\Roaming\npm-cache\_logs
  \2021-04-24T07_04_59_173Z-debug.log

首先,嘗試更新您的 node.js 文件,然后運行“npm run dev”,如果您再次遇到同樣的問題,請按照以下步驟操作:

Step1: composer update
Step2: rm -rf node_modules
Step3: npm cache clean
Step4: npm install
Step5: npm outdated

在這一步中,它將更新您的 laravel-mix 版本,它位於 package.json 中。

Step6: npm install
Step7: npm run dev

經過所有這些步驟,一切都很好。 我希望它能解決你的問題。

安裝適用於 Windows 的git bash並導航到項目目錄。

右鍵單擊該文件夾並選擇git bash here

之后,你可以運行

npm install && npm run dev

在你的 Git Bash 窗口上。

(不管你使用什么版本的 nodejs,因為我們知道在 windows7 上運行新版本的 nodejs 非常困難,所以這個解決方案對我來說也適用)!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM