首页 > 其他分享 >启动Vue出现npm ERR! code ENOENT和npm ERR! Missing script: "serve"

启动Vue出现npm ERR! code ENOENT和npm ERR! Missing script: "serve"

时间:2022-08-30 18:36:59浏览次数:57  
标签:npm code cli service ERR vue build

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

 

标签:npm,code,cli,service,ERR,vue,build
From: https://www.cnblogs.com/flsh/p/16640419.html

相关文章

  • Xcode断点调试的值均为nil,控制台打印却有值
    <!--run--><style>.box{box-shadow:5px5px10px#000000;border-radius:10px;}</style><divclass=“box">SDK调试Xcode断点发现断点下的局部变量的值均为......
  • NS3 Aqua-sim之二:配置VSCode
    NS3Aqua-sim之二:配置VSCode环境:Ubuntu18.04.6LTSgccversion7.3.0NS-3.26安装VSCode本人使用的方式较为简单,从Ubuntu自带的软件中心搜索code点击安装网络给......
  • "errMsg": "uploadFile:fail undefined" 手机端上传头像提示uploadFile未定义
    <template> <view> <viewstyle="display:flex;"> <viewclass="form-left"> 照片 </view> <viewstyle="margin-left:6px;"> <view......
  • Docker版本的Jenkins 安装 npm
    在实现docker版本的jenkins时遇见jenkinsnpmnotfound的错误。原因:容器中没有安装nodejs,npm。故自定义构建镜像并安装nodejs,npmDockerfileFROMjenkins......
  • vscode插件代码滚动截图
    前言在网上看到很多技术博客的时候,我们经常可以看到很多大佬们分享的技术文章都包含着很多代码片段。而且代码片段可以看到都是可以滚动的,下面就来看看怎么在vscode代码编......
  • [Typescript] Step5. Local types override
    Step5.LocaltypesoverrideYoucanfindmany@typespackagealongwiththelibraryyouuse.Buttheproblemisthatthose@typesmightcontainbugsbecausela......
  • JS hashCode()
     functionhashcode(str){varhash=0,i,chr,len;if(str.length===0)returnhash;for(i=0,len=str.length;i<len;i++){chr=str.charCo......
  • AtCoder Beginner Contest 266 一句话题解
    AandBsbt,不讲。C垃圾计算几何,问是不是一个凸包,搞份板子交就可以了。D简单dp,令\(f(i,j)\)表示第\(i\)个时间在第\(j\)个位置的最大价值,从上一个时间转移,可以......
  • leetcode 28. Implement strStr() 实现 strStr()(简单)
    一、题目大意实现strStr()函数。给你两个字符串haystack和needle,请你在haystack字符串中找出needle字符串出现的第一个位置(下标从0开始)。如果不存在,则返回......
  • Cocos 二维码动态生成(QRCode、JQuery)
    版本:2.4.4jquery.qrcode库文件:下载地址 一效果展示根据地址http://www.xxx.com动态生成一个二维码,logo图片可自定义。 二生成二维码需要的库,JQuery和JQuery.qrc......