首页 > 解决方案 > 当我运行“npm install”时,我的终端上出现此错误消息“npm ERR!Linux 5.4.72-microsoft-standard-WSL2”

问题描述

我有这个错误信息:npm ERR! Linux 5.4.72-microsoft-standard-WSL2当我运行时在我的终端上npm install。我在一个 vue.js 应用程序上,自从我安装了 vuetify 后我就收到了这条消息。这是整个错误消息:

npm ERR! Linux 5.4.72-microsoft-standard-WSL2
npm ERR! argv "/home/josephine/.nvm/versions/node/v14.15.0/bin/node" "/home/josephine/.nvm/versions/node/v14.15.0/bin/npm" "install"
npm ERR! node v14.15.0
npm ERR! npm  v3.10.10
npm ERR! cb.apply is not a function.

我也无法安装最新版本的 npm 我认为这与问题有关。(我有这个版本v3.10.10)。当我跑步时,npm run serve我有这个:

> vue-cli-service serve
sh: 1: vue-cli-service: not found
npm ERR! Linux 5.4.72-microsoft-standard-WSL2
npm ERR! argv "/home/josephine/.nvm/versions/node/v14.15.0/bin/node" "/home/josephine/.nvm/versions/node/v14.15.0/bin/npm" "run" "serve"
npm ERR! node v14.15.0
npm ERR! npm  v3.10.10
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! my-app@0.1.0 serve: vue-cli-service serve
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the my-app@0.1.0 serve script 'vue-cli-service serve'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the my-app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     vue-cli-service serve
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs my-app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls my-app
npm ERR! There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?`.

我有 Vue.JS 版本@ vue / cli 4.5.12。最后,我有一台 Window PC,我已经安装了 linux 和 ubuntu。如果你能帮助我,我提前感谢你。

标签: javascriptwindowsvue.jsvuetify.jswsl-2

解决方案


您的 npm 版本已过时。您的版本是 3.x,但我们目前是 7.x

npm update -g

然后再试一次。


推荐阅读