Ionic 3项目中的Node JS和SASS不兼容问题

时间:2019-05-19 13:50:59

标签: node.js typescript ionic-framework npm sass

我正在尝试重建在另一台机器上编码的Ionic 3.9.2项目,并且已经构建了一个新的Ionic项目并将“外国”项目文件传输到该项目。但是当我在终端中运行ionic serve -l来可视化项目时,我遇到了一个SASS设置错误,如图所示:

enter image description here

要修复此问题,我卸载了64位Node JS 6.11.1并安装了32位版本。但是现在尝试构建项目时,我在终端上遇到了新的错误:

首先我得到:

  

错误:缺少绑定C:\ crepe \ node_modules \ node-sass \ vendor \ win32-ia32-48 \ binding.node   Node Sass找不到您当前环境的绑定:Windows 32位,带有Node.js 6.x   找到以下环境的绑定:     -具有Node.js 6.x的Windows 64位   这通常是因为自运行npm install以来您的环境已更改。   运行npm rebuild node-sass --force为当前环境构建绑定。

所以我运行了指示的命令:npm rebuild node-sass --force

但是现在我收到了很多新错误:

  

node-sass@4.5.3安装C:\ crepe \ node_modules \ node-sass   节点脚本/install.js   从https://github.com/sass/node-sass/releases/download/v4.5.3/win32-ia32-48_binding.node下载二进制文件   下载完成 ] - :   二进制保存到C:\ crepe \ node_modules \ node-sass \ vendor \ win32-ia32-48 \ binding.node   将二进制文件缓存到C:\ Users \ User \ AppData \ Roaming \ npm-cache \ node-sass \ 4.5.3 \ win32-ia32-48_binding.node

     

node-sass@4.5.3安装后C:\ crepe \ node_modules \ node-sass   节点脚本/build.js   生成:C:\ Program Files(x86)\ nodejs \ node.exe C:\ crepe \ node_modules \ node-gyp \ bin \ node-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 (x86)\\nodejs\\node.exe',
gyp verb cli   'C:\\crepe\\node_modules\\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.8.0    

gyp info using node@6.11.1 | win32 | ia32
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
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 (C:\crepe\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\crepe\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\crepe\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\crepe\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\crepe\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\crepe\node_modules\isexe\windows.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 (C:\crepe\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\crepe\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\crepe\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\crepe\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\crepe\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\crepe\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:123:15)
gyp verb `which` failed   stack: 'Error: not found: python2\n    at getNotFoundError (C:\\crepe\\node_modules\\which\\which.js:13:12)\n    at F (C:\\crepe\\node_modules\\which\\which.js:68:19)\n    at E (C:\\crepe\\node_modules\\which\\which.js:80:29)\n    at C:\\crepe\\node_modules\\which\\which.js:89:16\n    at C:\\crepe\\node_modules\\isexe\\index.js:42:5\n    at C:\\crepe\\node_modules\\isexe\\windows.js:36:5\n    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` failed Error: not found: python
gyp verb `which` failed     at getNotFoundError (C:\crepe\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\crepe\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\crepe\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\crepe\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\crepe\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\crepe\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:123:15)
gyp verb `which` failed  python { Error: not found: python
gyp verb `which` failed     at getNotFoundError (C:\crepe\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\crepe\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\crepe\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\crepe\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\crepe\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\crepe\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:123:15)


gyp verb `which` failed     at getNotFoundError (C:\crepe\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\crepe\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\crepe\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\crepe\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\crepe\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\crepe\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:123:15)
gyp verb `which` failed   stack: 'Error: not found: python2\n    at getNotFoundError (C:\\crepe\\node_modules\\which\\which.js:13:12)\n    at F (C:\\crepe\\node_modules\\which\\which.js:68:19)\n    at E (C:\\crepe\\node_modules\\which\\which.js:80:29)\n    at C:\\crepe\\node_modules\\which\\which.js:89:16\n    at C:\\crepe\\node_modules\\isexe\\index.js:42:5\n    at C:\\crepe\\node_modules\\isexe\\windows.js:36:5\n    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` failed Error: not found: python
gyp verb `which` failed     at getNotFoundError (C:\crepe\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\crepe\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\crepe\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\crepe\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\crepe\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\crepe\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:123:15)
gyp verb `which` failed  python { Error: not found: python
gyp verb `which` failed     at getNotFoundError (C:\crepe\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\crepe\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\crepe\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\crepe\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\crepe\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\crepe\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:123:15)
gyp verb `which` failed   stack: 'Error: not found: python\n    at getNotFoundError (C:\\crepe\\node_modules\\which\\which.js:13:12)\n    at F (C:\\crepe\\node_modules\\which\\which.js:68:19)\n    at E (C:\\crepe\\node_modules\\which\\which.js:80:29)\n    at C:\\crepe\\node_modules\\which\\which.js:89:16\n    at C:\\crepe\\node_modules\\isexe\\index.js:42:5\n    at C:\\crepe\\node_modules\\isexe\\windows.js:36:5\n    at FSReqWrap.oncomplete (fs.js:123:15)',
gyp verb `which` failed   code: 'ENOENT' }
gyp verb could not find "python". checking python launcher
gyp verb could not find "python". guessing location
gyp verb ensuring that file exists: C:\Python27\python.exe
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at Object.failNoPython (C:\crepe\node_modules\node-gyp\lib\configure.js:484:19)
gyp ERR! stack     at Object.<anonymous> (C:\crepe\node_modules\node-gyp\lib\configure.js:509:16)
gyp ERR! stack     at C:\crepe\node_modules\graceful-fs\polyfills.js:282:31
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:123:15)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\crepe\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\crepe\node_modules\node-sass
gyp ERR! node -v v6.11.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
node-sass@4.5.3 C:\crepe\node_modules\node-sass

我正在使用Ionic 3.9.2,Angular 5.0.0和Node JS 6.11.1 32位。我该怎么办?

1 个答案:

答案 0 :(得分:0)

根据此documentation,您应该安装Node.js LTS(当前为 v10.15.3 )而不是 v6.11.1 。并保持npm的最新状态

$ npm i -g npm

更新Node.js后,在本地重新安装node_modules。最好删除 ex -node_modules文件夹和package-lock.json文件。

希望这会有所帮助。