解决 This is probably not a problem with npm. There is likely additional logging output above.

发布时间 2023-06-13 18:10:19作者: 舞步林云
在执行 npm run serve 运行项目的时候报错:

dengzemiaodeMacBook-Pro:lianshan_vue dengzemiao$ npm run serve

......

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! lianshan@2.0.0 serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the lianshan@2.0.0 serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/dengzemiao/.npm/_logs/2021-01-14T06_10_01_084Z-debug.log

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14

如果出现这种报错情况,需要重新安装 node_modules 文件夹中的内容 但是在安装前,要把之前的内容都清空掉。

其实大多数的主要问题是 package-lock.json 这个文件,一般使用 1、2、4 步就够了,如果不行在重新 1、2、3、4 步,因为使用了 第3步,在 $ npm install 安装会要点时间,相对较慢。

步骤如下:

1、首先删除 node_modules,可以命令行删除,也可以手动右键删除文件夹。

$ rmdir /s/q node_modules

    1

2、删除 package-lock.json 文件

3、运行命令

$ npm cache clean --force

    1

4、重新加载

$ npm install
————————————————
版权声明:本文为CSDN博主「卡尔特斯」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/zz00008888/article/details/112607625