Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.5k views
in Technique[技术] by (71.8m points)

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:myprojectvuevue-x.
?  Initializing git repository...
??  Installing CLI plugins. This might take a while..
.


> fibers@4.0.3 install D:myprojectvuevue-x
ode_modulesfibers
> node build.js || nodejs build.js


D:myprojectvuevue-x
ode_modulesfibers>if not defined npm_config_node_gyp (node "D:software
ode_modules
pm
ode_modules
pm-lifecycle
ode-gyp-bin\....
ode_modules
ode-gypin
ode-gyp.js" rebuild --release )  else (node "node C:UsersmeAppDataRoaming
pm
ode_modules
ode-gypin
ode-gyp.js" rebuild --release )
internal/modules/cjs/loader.js:1033
  throw err;
  ^

Error: Cannot find module 'D:myprojectvuevue-x
ode_modulesfibers
ode C:UsersmeAppDataRoaming
pm
ode_modules
ode-gypin
ode-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:UsersadminAppDataRoaming
pm-cache\_logs2021-01-15T11_27_05_219Z-debug.log
 ERROR  command failed: npm install --loglevel error

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
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-toolspython38
2.3配置Python依赖npm config set python /path/to/executable/python


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...