npm install 错误问题 gyp ERR! configure error gyp ERR! stack Error: Command failed: C:\Users\Zhan

刚开始使用vscode打开一个已写好的vue。
1.根据网上教程,下载并配置好nodejs
2.利用vscode打开已有vue文件
3.使用命令行,输入

npm install

4.然后就报出如下错误

localhost:react-first changwei$ npm install --save react-router
npm WARN deprecated core-js@1.2.7: core-js@<2.6.5 is no longer maintained. Please, upgrade to core-js@3 or at least to actual version of core-js@2.

> fsevents@1.2.4 install /Users/changwei/project/react-first/node_modules/fsevents
> node install

node-pre-gyp WARN Tried to download(404): https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.2.4/fse-v1.2.4-node-v67-darwin-x64.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for fsevents@1.2.4 and node@11.12.0 (node-v67 ABI, unknown) (falling back to source compile with node-gyp) 
gyp ERR! configure error 
gyp ERR! stack Error: Command failed: /Users/changwei/anaconda3/bin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack 
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:297:12)
gyp ERR! stack     at ChildProcess.emit (events.js:197:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:988:16)
gyp ERR! stack     at Socket.stream.socket.on (internal/child_process.js:404:11)
gyp ERR! stack     at Socket.emit (events.js:197:13)
gyp ERR! stack     at Pipe._handle.close (net.js:611:12)
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/usr/local/Cellar/node/11.12.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users/changwei/project/react-first/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node" "--module_name=fse" "--module_path=/Users/changwei/project/react-first/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64" "--napi_version=4" "--node_abi_napi=napi"
gyp ERR! cwd /Users/changwei/project/react-first/node_modules/fsevents
gyp ERR! node -v v11.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node/11.12.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/changwei/project/react-first/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node --module_name=fse --module_path=/Users/changwei/project/react-first/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64 --napi_version=4 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/changwei/project/react-first/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:197:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:988:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
node-pre-gyp ERR! System Darwin 17.7.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/11.12.0/bin/node" "/Users/changwei/project/react-first/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/changwei/project/react-first/node_modules/fsevents
node-pre-gyp ERR! node -v v11.12.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.0
node-pre-gyp ERR! not ok 

感觉像是python找不到,或者py的版本不对
5.解决以上报错
卸载并重新安装、配置 nodejs
********实测有效!
备注:npm install 没问题后,再 npm run dev 还是报错,运行不起来,看一下错误。一般应该是 Cannot find module 'node-sass‘,然后按照网上教程再操作一下,就可以了。
友情链接('node-sass‘):https://blog.csdn.net/com_it/article/details/95043471

  • 4
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 6
    评论
### 回答1: gyp err! 配置错误 npm err! gyp err! 堆栈错误: 命令失败:c:\u。 gyp err! 是指在使用npm install安装某个包时,出现了配置错误。这可能是由于一些环境依赖或者包本身的问题导致的。npm err! 是npm工具提供的错误提示。gyp err! stack error: command failed: c:\u。这段错误信息提示了在执行某个命令时失败了,具体的失败原因可能在之前的错误信息中有进一步说明。 要解决这个问题,我们可以尝试以下几步: 1. 首先,我们可以尝试重新安装这个包。可以使用npm uninstall命令卸载当前安装的包,然后使用npm install命令重新安装。 2. 如果重新安装仍然失败,我们可以尝试升级npm工具本身。可以使用npm install -g npm命令来进行升级。 3. 如果升级npm还是没有解决问题,我们可以检查一下系统的环境依赖。如果该包依赖于一些系统环境或依赖库,我们需要确保这些依赖已经正确地安装和配置。可以查询包的官方文档,查看所需的环境依赖,并按照文档中的指引进行安装和配置。 4. 如果还是无法解决问题,我们可以尝试使用其他的包管理器,比如yarn。可以使用yarn安装命令来替代npm install进行安装,并观察是否能够成功。 总之,解决gyp err! configure error npm err! gyp err! stack error: command failed: c:\u的问题可能需要尝试多种方法,从重新安装包到升级npm工具,再到检查环境依赖。希望这些方法能够帮助您解决问题。 ### 回答2: gyp err! configure errornpm 安装模块时出现的错误信息,通常是因为缺少或不匹配的依赖项导致的。npm err! gyp err! stack error: command failed: c:\u 则显示了具体的命令执行错误。 要解决这个问题,可以尝试以下几个解决方法: 1. 确保你的电脑上已经正确安装了所需的编译工具和依赖项。具体需要什么工具和依赖项可以根据你使用的模块的要求来确定,可以查看该模块的官方文档或者开发者社区来获取相关信息。 2. 检查你的 npm 版本是否过低,如果是的话,可以尝试更新 npm 到最新版本。可以使用命令 npm install npm@latest -g 来进行更新。 3. 清除 npm 的缓存,并重新安装需要的模块。可以使用命令 npm cache clean --force 来清除缓存,然后再次运行安装命令。 4. 确保你的网络连接正常,有时候下载依赖项的过程中会因为网络问题导致安装失败,可以尝试使用稳定的网络连接或者使用代理服务器来解决问题。 5. 如果以上方法都无法解决问题,可以尝试在安装模块时使用 --ignore-scripts 参数,跳过模块的脚本执行。不过这种方法可能会导致一些功能无法正常使用,所以请谨慎使用。 希望以上方法能够帮助你解决 gyp err! configure errornpm err! gyp err! stack error: command failed: c:\u 的问题。如果问题仍然存在,建议你查阅相关的文档或寻求开发者社区的帮助来获取更多解决方法。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值