vue create项目报错?if not defined npm_config_node_gyp

vue create项目报错?if not defined npm_config_node_gyp请问怎么解决?

Vue CLI v4.5.10
✨  Creating project in D:\myproject\vue\vue-x.
�  Initializing git repository...
⚙️  Installing CLI plugins. This might take a while..
.


> fibers@4.0.3 install D:\myproject\vue\vue-x\node_modules\fibers
> node build.js || nodejs build.js


D:\myproject\vue\vue-x\node_modules\fibers>if not defined npm_config_node_gyp (node "D:\software\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild --release )  else (node "node C:\Users\me\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild --release )
internal/modules/cjs/loader.js:1033
  throw err;
  ^

Error: Cannot find module 'D:\myproject\vue\vue-x\node_modules\fibers\node C:\Users\me\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1030:15)
    at Function.Module._load (internal/modules/cjs/loader.js:899: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: []
}
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows + OS X instructions here: https://github.com/nodejs/node-gyp
Ubuntu users please run: `sudo apt-get install g++ build-essential`
RHEL users please run: `yum install gcc-c++` and `yum groupinstall 'Development Tools'`
Alpine users please run: `sudo apk add python make g++`
'nodejs' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fibers@4.0.3 install: `node build.js || nodejs build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fibers@4.0.3 install 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\admin\AppData\Roaming\npm-cache\_logs\2021-01-15T11_27_05_219Z-debug.log
 ERROR  command failed: npm install --loglevel error
阅读 4.8k
1 个回答
Windows + OS X instructions here: https://github.com/nodejs/nod...
Ubuntu users please run: sudo apt-get install g++ build-essential
RHEL users please run: yum install gcc-c++ and yum groupinstall 'Development Tools'
Alpine users please run: sudo apk add python make g++

Windows下参考文档

    1. npm install -g node-gyp
    1. 安装相关系统环境

2.1以管理员身份运行npm install --global windows-build-tools
2.2查看python相关安装路径windows-build-toolsWhere is Python installed?%USERPROFILE%\.windows-build-tools\python38
2.3配置Python依赖npm config set python /path/to/executable/python

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题