node版本问题

服务器下载下来的vue项目启动出现下列问题

npm ERR! path E:\vueEnv\app\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: C:\Program Files\nodejs\node.exe E:\vueEnv\app\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
npm ERR! gyp verb cli   'E:\\vueEnv\\app\\node_modules\\node-gyp\\bin\\node-gyp.js',
npm ERR! gyp verb cli   'rebuild',
npm ERR! gyp verb cli   '--verbose',
npm ERR! gyp verb cli   '--libsass_ext=',
npm ERR! gyp verb cli   '--libsass_cflags=',
npm ERR! gyp verb cli   '--libsass_ldflags=',
npm ERR! gyp verb cli   '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []

node版本问题_第1张图片
解决方法一
卸载 node-sass

 npm uninstall node-sass
 #安装 node对应版本的
  npm i -D sass
  npm cache clean -f
  npm install
  npm serve

之后启动项目又遇到
node版本问题_第2张图片
set NODE_OPTIONS=–openssl-legacy-provider
npm run serve
#启动失败可能配置失败,再次设置
$env:NODE_OPTIONS=“–openssl-legacy-provider”
npm run serve

方法二:
降低node版本 直接使用yarn启动

切换node版本

下载nvm管理包

https://github.com/coreybutler/nvm-windows/releases

#查看当前版本号 nvm v 有说明安装成功
#输入nvm ls available查看当前版本号
安装命令 nvm install 16.17
使用命令nvm use 16.17

node 常用命令记录

#npm更新到最新
npm install -g npm
#npm更新指定版本
npm install [email protected] -g 
#强制清楚缓存
npm cache clean -f

你可能感兴趣的:(node,rust,开发语言,后端)