npm run serve 报错:
在这里插入图片描述
在这里插入图片描述

/usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npm-cli.js run serve --scripts-prepend-node-path=auto

platform-ui@0.1.0 serve ****
vue-cli-service serve --open

internal/modules/cjs/loader.js:968
throw err;
^

Error: Cannot find module ‘…/package.json’
Require stack:
(internal/modules/run_main.js:71:12) {
code: ‘MODULE_NOT_FOUND’,
requireStack: [
‘/Users/*/-platform-ui/node_modules/.bin/vue-cli-service’
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! platform-ui@0.1.0 serve: vue-cli-service serve --open
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the platform-ui@0.1.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/***/.npm/_logs/2021-02-25T08_09_57_007Z-debug.log

原因是node_modules文件夹有意外改动,导致依赖库不完整。
解决:

解决:
删除项目下的node_modules
在项目目录下重新执行npm install ,会重新生成node_modules
执行npm run build
执行npm run serve

Logo

前往低代码交流专区

更多推荐