【npm 报错 gyp info it worked if it ends with ok 大概率是包版本问题】

node/ node-sass/sass-loader版本兼容问题

问题描述:之前的项目在新电脑上运行时,因为node版本过高,运行npm报错

npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli ‘D:\Software\nodejs\node.exe’,
npm ERR! gyp verb cli ‘D:\代码\web\newxfxt\node_modules\node-gyp\bin\node-gyp.js’,
npm ERR! gyp verb cli ‘rebuild’,
npm ERR! gyp verb cli ‘–verbose’,
npm ERR! gyp verb cli ‘–libsass_ext=’,
npm ERR! gyp verb cli ‘–libsass_cflags=’,
npm ERR! gyp verb cli ‘–libsass_ldflags=’,
npm ERR! gyp verb cli ‘–libsass_library=’
npm ERR! gyp verb cli ]
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing “build” directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable “python2” in the PATH
npm ERR! gyp verb which failed Error: not found: python2

【npm 报错 gyp info it worked if it ends with ok 大概率是包版本问题】_第1张图片
删除node_modules文件夹和package-lock.json,修改package.json文件:

"devDependencies": {
	"sass-loader":"^10.2.0",
    "node-sass":"^6.0.1",
}

或者
1、npm uninstall node-sass;
2、npm i -D sass;
3、npm run dev;

改完后 npm install 完成.
参考:http://www.136.la/nginx/show-243852.html

node-sass对node的版本支持
【npm 报错 gyp info it worked if it ends with ok 大概率是包版本问题】_第2张图片
node 对node-sass的支持
【npm 报错 gyp info it worked if it ends with ok 大概率是包版本问题】_第3张图片

你可能感兴趣的:(前端,vue,npm,node.js,前端)