启动Vue出现npm ERR! code ENOENT和npm ERR! Missing script: "serve"
npm ERR! code ENOENT npm ERR! syscall open npm ERR! path D:\java\springbootAndVue\前端/package.json npm ERR! errno -4058 npm ERR! enoent ENOENT: no such file or directory, open 'D:\java\springbootAndVue\前端\package.json' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\小鱼\AppData\Local\npm-cache\_logs\2022-08-30T09_54_34_476Z-debug.lo
因为
npm ERR! path D:\java\springbootAndVue\前端/package.json
原先的是
需要把package-lock.json的-lock去掉
成package-lock.json就好了
npm ERR! Missing script: "serve" npm ERR! npm ERR! To see a list of scripts, run: npm ERR! npm run npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\小鱼\AppData\Local\npm-cache\_logs\2022-08-30T10_06_18_586Z-debug.log
将package-lock.json中的sciptsd修改为
"scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build", "lint": "vue-cli-service lint", "dev": "vue-cli-service serve", "build:prod": "vue-cli-service build", "build:stage": "vue-cli-service build --mode staging", "preview": "node build/index.js --preview", "test:unit": "jest --clearCache && vue-cli-service test:unit", "test:ci": "npm run lint && npm run test:unit", "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml", "new": "plop" }
就好了,我原先没有sciptsd的,后面我自己加上
{ "name": "前端", "lockfileVersion": 2, "requires": true, "packages": {}, "scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build", "lint": "vue-cli-service lint", "dev": "vue-cli-service serve", "build:prod": "vue-cli-service build", "build:stage": "vue-cli-service build --mode staging", "preview": "node build/index.js --preview", "test:unit": "jest --clearCache && vue-cli-service test:unit", "test:ci": "npm run lint && npm run test:unit", "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml", "new": "plop" } }
分类:
前端
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?