报错内容

D:\node_modules\node-pty>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gy
p.js" rebuild )  else (node "node C:\nodejs\node_global\node_modules\node-gyp\bin\node-gyp.js" rebuild )
internal/modules/cjs/loader.js:968
  throw err;
  ^

Error: Cannot find module 'D:\node_modules\node-pty\node C:\nodejs\node_global\node_modules\node-gyp\bin\node-gyp.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
    at Function.Module._load (internal/modules/cjs/loader.js:841:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

解决方案:

1.先执行

npm install -g node-gyp

在C:\Users\Administrator\ .npmrc 中添加你刚刚安装的路径

npm_config_node_gyp=C:\nodejs\node_global\node_modules\node-gyp\bin\node-gyp.js

在这里插入图片描述

Logo

基于 Vue 的企业级 UI 组件库和中后台系统解决方案,为数万开发者服务。

更多推荐