启动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" } }