macrozheng / mall-admin-web

mall-admin-web是一个电商后台管理系统的前端项目,基于Vue+Element实现。 主要包括商品管理、订单管理、会员管理、促销管理、运营管理、内容管理、统计报表、财务管理、权限管理、设置等功能。
https://www.macrozheng.com/admin/
Apache License 2.0
11.85k stars 7.17k forks source link

node-sass version好像不对,但是又装不上^4.0.0的 #129

Open xuwuqiang opened 3 years ago

xuwuqiang commented 3 years ago

一开始报python没有,装了之后报vscode没有,装了之后install成功了,但是npm run的时候提示node-sass下面的vendor目录缺少东西,我一看根本就没有vendor目录,找到node-sass的github,还是没有找到vendor目录,在stackoverflow上搜到说是需要自己创建vendor目录,并且下载对应的binding.node文件放进去,放进去之后提示我node-sass版本太高,于是我安装node-sass^4.0.0,就装不上了.

我最后一次的命令是 npm install node-sass@^4.0.0 报错信息是 npm ERR! code 1 npm ERR! path D:\project\mall-admin-web\node_modules\node-sass npm ERR! command failed npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@3.8.0 npm ERR! gyp info using node@14.17.3 | win32 | x64 npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack Error: Command failed: D:\laragon\bin\python3\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3]; npm ERR! gyp ERR! stack File "", line 1 npm ERR! gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3]; npm ERR! gyp ERR! stack ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ npm ERR! gyp ERR! stack SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)? npm ERR! gyp ERR! stack npm ERR! gyp ERR! stack at ChildProcess.exithandler (child_process.js:319:12) npm ERR! gyp ERR! stack at ChildProcess.emit (events.js:375:28) npm ERR! gyp ERR! stack at maybeClose (internal/child_process.js:1055:16) npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5) npm ERR! gyp ERR! System Windows_NT 10.0.19043 npm ERR! gyp ERR! command "D:\app\nodejs\node.exe" "D:\project\mall-admin-web\node_modules\node-gyp\bin\node-gyp.js" "rebuild" npm ERR! gyp ERR! cwd D:\project\mall-admin-web\node_modules\node-sass npm ERR! gyp ERR! node -v v14.17.3 npm ERR! gyp ERR! node-gyp -v v3.8.0 npm ERR! gyp ERR! not ok

看上去是一个python的错误,我已经折腾一天了,本来是想学习一下springboot的,结果这一天下来不知道在干嘛,这些前端的问题对我真的不太友好..............

xuwuqiang commented 3 years ago

给我的一种感觉是这个项目因为node版本的原因年久失修....

xuwuqiang commented 3 years ago

最后安装上了 npm install node-sass@^4.14.0 下载文件 : https://github.com/sass/node-sass/releases/download/v4.14.1/win32-x64-83_binding.node 移动 : mv win32-x64-83_binding.node mall-admin-web/node_modules/node-sass/vendor/win32-x64-83/binding.node npm run dev

xuwuqiang commented 3 years ago

说明下我的本地环境 system win10 npm -v 7.23.0 node -v v14.17.3

SHEEP-PLUS commented 3 years ago

先删除 npm uninstall node-sass 再安装最新版本 npm install node-sass@latest

wangdi7670 commented 2 years ago

我是这么解决的: npm install node-sass@latest --sass-binary-site=https://npm.taobao.org/mirrors/node-sass 本地环境:node v16.13.0 这里有node 和node-sass版本对应关系

silent-waiting commented 2 years ago

npm install --unsafe-perm //这是解决gyp报错的方法

Zenquan commented 2 years ago

npm rebuild node-sass 即可解决

xiaochengzjc commented 1 year ago

我是这么解决的: npm install node-sass@latest --sass-binary-site=https://npm.taobao.org/mirrors/node-sass 本地环境:node v16.13.0 这里有node 和node-sass版本对应关系

正解