npm和别人的报错不一样,如何解决?

D:\1\新建文件夹\pc-underwrite>npm run serve

h5uw@0.1.0 serve D:\1\新建文件夹\pc-underwrite
set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve

node: --openssl-legacy-provider is not allowed in NODE_OPTIONS
npm ERR! code ELIFECYCLE
npm ERR! errno 9
npm ERR! h5uw@0.1.0 serve: set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve
npm ERR! Exit status 9
npm ERR!
npm ERR! Failed at the h5uw@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! C:\Users\xz51\AppData\Roaming\npm-cache_logs\2023-07-14T09_30_18_387Z-debug.log

D:\1\新建文件夹\pc-underwrite>npm run dev
npm ERR! missing script: dev

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\xz51\AppData\Roaming\npm-cache_logs\2023-07-14T09_30_25_645Z-debug.log

已解决,开始在这个vue-cli-service serve前面多加了一个 serve: set NODE_OPTIONS=--openssl-legacy-provider && 不管用,后来node版本过高,降低了版本,出现了npm ERR! errno 9
npm ERR! h5uw@0.1.0 serve: set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve这个错误,忘记了,把这个前面多加的删除就好使了,多谢大家

提示:没有dev这个命令,打开package.json文件,查看有些什么命令

img

原因可能是:node版本高,对于低版本的包不兼容了

在 package.json 文件中修改对应的 scripts 节点的内容如下:
 
"serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
"build": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build",