$ cnpm install node-sass --save-dev
√ Installed 1 packages
√ Linked 18 latest versions
node-sass build Binary found at D:
8
web
ode_modules\_node-sass@4.5.3@node-sassvendorwin32-x64-48inding.node
Binary found at D:
8
web
ode_modules\_node-sass@4.5.3@node-sassvendorwin32-x64-48inding.node
Testing binary
Binary has a problem: Error: %1 is not a valid Win32 application.
\?D:
8
web
ode_modules\_node-sass@4.5.3@node-sassvendorwin32-x64-48inding.node
at Error (native)
at Object.Module._extensions..node (module.js:597:18)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at module.exports (D:
8
web
ode_modules\_node-sass@4.5.3@node-sasslibinding.js:19:10)
at Object.<anonymous> (D:
8
web
ode_modules\_node-sass@4.5.3@node-sasslibindex.js:14:35)
at Module._compile (module.js:570:32)
Building the binary locally
Building: C:Program Files
odejs
ode.exe D:
8
web
ode_modules\_node-gyp@3.6.2@node-gypin
ode-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ 'C:\Program Files\nodejs\node.exe',
gyp verb cli 'D:\n8\nweb\node_modules\_node-gyp@3.6.2@node-gyp\bin\node-gyp.js',
gyp verb cli 'rebuild',
gyp verb cli '--verbose',
gyp verb cli '--libsass_ext=',
gyp verb cli '--libsass_cflags=',
gyp verb cli '--libsass_ldflags=',
gyp verb cli '--libsass_library=' ]
gyp info using node-gyp@3.6.2
gyp info using node@6.10.0 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb download using dist-url https://npm.taobao.org/mirrors/node
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed at getNotFoundError (D:
8
web
ode_modules\_which@1.3.0@whichwhich.js:13:12)
gyp verb `which` failed at F (D:
8
web
ode_modules\_which@1.3.0@whichwhich.js:68:19)
gyp verb `which` failed at E (D:
8
web
ode_modules\_which@1.3.0@whichwhich.js:80:29)
gyp verb `which` failed at D:
8
web
ode_modules\_which@1.3.0@whichwhich.js:89:16
gyp verb `which` failed at D:
8
web
ode_modules\_isexe@2.0.0@isexeindex.js:42:5
gyp verb `which` failed at D:
8
web
ode_modules\_isexe@2.0.0@isexewindows.js:36:5
gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:123:15)
gyp verb `which` failed python2 { Error: not found: python2
gyp verb `which` failed at getNotFoundError (D:
8
web
ode_modules\_which@1.3.0@whichwhich.js:13:12)
gyp verb `which` failed at F (D:
8
web
ode_modules\_which@1.3.0@whichwhich.js:68:19)
gyp verb `which` failed at E (D:
8
web
ode_modules\_which@1.3.0@whichwhich.js:80:29)
gyp verb `which` failed at D:
8
web
ode_modules\_which@1.3.0@whichwhich.js:89:16
gyp verb `which` failed at D:
8
web
ode_modules\_isexe@2.0.0@isexeindex.js:42:5
gyp verb `which` failed at D:
8
web
ode_modules\_isexe@2.0.0@isexewindows.js:36:5
gyp verb `which` failed at FSReqWrap.oncomplete (fs.js:123:15)
gyp verb `which` failed stack: 'Error: not found: python2
at getNotFoundError (D:\n8\nweb\node_modules\_which@1.3.0@which\which.js:13:12)
at F (D:\n8\nweb\node_modules\_which@1.3.0@which\which.js:68:19)
at E (D:\n8\nweb\node_modules\_which@1.3.0@which\which.js:80:29)
at D:\n8\nweb\node_modules\_which@1.3.0@which\which.js:89:16
at D:\n8\nweb\node_modules\_isexe@2.0.0@isexe\index.js:42:5
at D:\n8\nweb\node_modules\_isexe@2.0.0@isexe\windows.js:36:5
at FSReqWrap.oncomplete (fs.js:123:15)',
gyp verb `which` failed code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python C:Usersasus-1AppDataLocalProgramsPythonPython36-32python.EXE
gyp verb check python version `C:Usersasus-1AppDataLocalProgramsPythonPython36-32python.EXE -c "import platform; print(platform.python_version());"` returned: "3.6.2
"
gyp verb could not find "C:Usersasus-1AppDataLocalProgramsPythonPython36-32python.EXE". checking python launcher
gyp verb could not find "C:Usersasus-1AppDataLocalProgramsPythonPython36-32python.EXE". guessing location
gyp verb ensuring that file exists: C:Python27python.exe
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:Usersasus-1AppDataLocalProgramsPythonPython36-32python.EXE", you can set the PYTHON env variable.
gyp ERR! stack at Object.failNoPython (D:
8
web
ode_modules\_node-gyp@3.6.2@node-gyplibconfigure.js:483:19)
gyp ERR! stack at Object.<anonymous> (D:
8
web
ode_modules\_node-gyp@3.6.2@node-gyplibconfigure.js:508:16)
gyp ERR! stack at D:
8
web
ode_modules\_graceful-fs@4.1.11@graceful-fspolyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:123:15)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\Program Files\nodejs\node.exe" "D:\n8\nweb\node_modules\_node-gyp@3.6.2@node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd D:
8
web
ode_modules\_node-sass@4.5.3@node-sass
gyp ERR! node -v v6.10.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Build failed with error code: 1
× Install fail! Error: post install error, please remove node_modules before retry!
Run "C:Windowssystem32cmd.exe /d /s /c node scripts/build.js" error, exit code 1
Error: post install error, please remove node_modules before retry!
Run "C:Windowssystem32cmd.exe /d /s /c node scripts/build.js" error, exit code 1
at ChildProcess.proc.on.code (C:Usersasus-1AppDataRoaming
pm
ode_modulescnpm
ode_modules
unscriptindex.js:74:21)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
npminstall version: 3.1.4
npminstall args: C:Program Files
odejs
ode.exe C:Usersasus-1AppDataRoaming
pm
ode_modulescnpm
ode_modules
pminstallininstall.js --china --userconfig=C:Usersasus-1.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=http://registry.npm.taobao.org node-sass --save-dev
解决方案:
https://github.com/sass/node-sass/releases
下载
win32-x64-48inding.node文件
在项目文件夹的 ode_modules\_node-sass@4.5.3@node-sassvendorwin32-x64-48目录下,用下载的文件替换原来的文件
再npm i node-sass --save 即可。
*github issue上网友的方法是找到C:UsersAdministratorAppDataRoaming
pm-cache
ode-sass版本号 文件夹,将下载的文件放进去,但我亲测无效。
最后说一句,真TM坑