gpt4 book ai didi

node.js - 使用npm install --production后遇到 "' vue-cli-service' is not recognized as an internal or external command”

转载 作者:行者123 更新时间:2023-12-05 06:19:13 27 4
gpt4 key购买 nike

我们的生产环境必须使用“npm install --production”来安装项目,但是当触发“npm run serve”时遇到以下错误:

'vue-cli-service' 不被识别为内部或外部命令,可运行的程序或批处理文件。错误!代码生命周期错误!错误号 1

这是命令序列:

  1. npm 安装 --production
  2. npm 运行服务

下面是package.json

{
"name": "xxxxxx",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^0.19.0",
"bootstrap": "^4.4.1",
"bootstrap-vue": "^2.7.0",
"core-js": "^3.4.3",
"vue": "^2.6.11",
"vue-router": "^3.1.3"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.1.0",
"@vue/cli-plugin-eslint": "^4.1.0",
"@vue/cli-service": "^4.1.0",
"babel-eslint": "^10.0.3",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.0.0",
"vue-template-compiler": "^2.6.11"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"rules": {
"no-console": "off"
},
"parserOptions": {
"parser": "babel-eslint"
}
},
"browserslist": [
"> 1%",`enter code here`
"last 2 versions"
]
}

任何人都可以帮助解决这个问题吗?非常感谢...

最佳答案

serve 脚本是否需要您的 devDependencies?如果您运行 npm install 那么 npm run serve 是否有效?

你能在你的产品环境中运行 vue --version 吗?这个错误让我觉得整个 @vue/cli 全局安装都丢失了。

帖子可能是骗人的:How to solve 'vue-cli-service' is not recognized as an internal or external command?

以防万一,您可能需要 rm -rf node_modules 然后安装,然后服务。

关于node.js - 使用npm install --production后遇到 "' vue-cli-service' is not recognized as an internal or external command”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60879341/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com