今天run serve时一直提示:
Syntax Error: Error: Cannot find module 'node-sass'
而尝试安装:npm install node-sass
又报错
pm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm WARN deprecated osenv@0.1.5: This package is no longer supported.
npm WARN deprecated npmlog@4.1.2: This package is no longer supported.
npm WARN deprecated glob@7.1.7: Glob versions prior to v9 are no longer supported
npm WARN deprecated are-we-there-yet@1.1.7: This package is no longer supported.
npm WARN deprecated gauge@2.7.4: This package is no longer supported.
npm WARN deprecated fstream@1.0.12: This package is no longer supported.
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm WARN deprecated node-sass@4.14.1: Node Sass is no longer supported. Please use `sass` or `sass-embedded` instead.
npm ERR! code 1
npm ERR! path D:\src\atguigu-course-master\course-mobile\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: C:\Program Files\nodejs\node.exe D:\src\atguigu-course-master\course-mobile\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli 'C:\\Program Files\\nodejs\\node.exe',
npm ERR! gyp verb cli 'D:\\src\\atguigu-course-master\\course-mobile\\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 node-gyp@3.8.0
npm ERR! gyp info using node@17.9.1 | 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 download using dist-url https://npm.taobao.org/dist
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 ERR! gyp verb `which` failed at getNotFoundError (D:\src\atguigu-course-master\course-mobile\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed at F (D:\src\atguigu-course-master\course-mobile\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed at E (D:\src\atguigu-course-master\course-mobile\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed at D:\src\atguigu-course-master\course-mobile\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed at D:\src\atguigu-course-master\course-mobile\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed at D:\src\atguigu-course-master\course-mobile\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:199:21)
npm ERR! gyp verb `which` failed python2 Error: not found: python2
npm ERR! gyp verb `which` failed at getNotFoundError (D:\src\atguigu-course-master\course-mobile\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed at F (D:\src\atguigu-course-master\course-mobile\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed at E (D:\src\atguigu-course-master\course-mobile\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed at D:\src\atguigu-course-master\course-mobile\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed at D:\src\atguigu-course-master\course-mobile\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed at D:\src\atguigu-course-master\course-mobile\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:199:21) {
npm ERR! gyp verb `which` failed code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp verb check python checking for Python executable "python" in the PATH
npm ERR! gyp verb `which` succeeded python C:\Python27\python.EXE
npm ERR! gyp verb check python version `C:\Python27\python.EXE -c "import sys; print "2.7.0
npm ERR! gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 17.9.1
npm ERR! gyp verb command install [ '17.9.1' ]
npm ERR! gyp verb download using dist-url https://npm.taobao.org/dist
npm ERR! gyp verb install input version string "17.9.1"
npm ERR! gyp verb install installing version: 17.9.1
npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
npm ERR! gyp verb install version not already installed, continuing with install 17.9.1
npm ERR! gyp verb ensuring nodedir is created C:\Users\win10\.node-gyp\17.9.1
npm ERR! gyp verb created nodedir C:\Users\win10\.node-gyp\17.9.1
npm ERR! gyp http GET https://npm.taobao.org/dist/v17.9.1/node-v17.9.1-headers.tar.gz
npm ERR! gyp WARN install got an error, rolling back install
npm ERR! gyp verb command remove [ '17.9.1' ]
npm ERR! gyp verb remove using node-gyp dir: C:\Users\win10\.node-gyp
npm ERR! gyp verb remove removing target version: 17.9.1
npm ERR! gyp verb remove removing development files for version: 17.9.1
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error [ERR_TLS_CERT_ALTNAME_INVALID]: Hostname/IP does not match certificate's altnames: Host: npm.taobao.org. is not in the cert's altnames: DNS:*.tbcdn.cn, DNS:*.taobao.com, DNS:*.alicdn.com, DNS:*.cmos.greencompute.org, DNS:cmos.greencompute.org, DNS:m.intl.taobao.com, DNS:*.mobgslb.tbcache.com, DNS:*.alikunlun.com, DNS:alikunlun.com, DNS:*.django.t.taobao.com, DNS:alicdn.com, DNS:*.tbcache.com, DNS:*.tmall.com, DNS:*.1688.com, DNS:*.3c.tmall.com, DNS:*.alibaba.com, DNS:*.aliexpress.com, DNS:*.aliqin.tmall.com, DNS:*.alitrip.com, DNS:*.aliyun.com, DNS:*.cainiao.com,
DNS:*.cainiao.com.cn, DNS:*.chi.taobao.com, DNS:*.chi.tmall.com, DNS:*.china.taobao.com, DNS:*.dingtalk.com, DNS:*.etao.com, DNS:*.feizhu.cn, DNS:*.feizhu.com, DNS:*.fliggy.com, DNS:*.fliggy.hk, DNS:*.food.tmall.com, DNS:*.jia.taobao.com, DNS:*.jia.tmall.com, DNS:*.ju.taobao.com, DNS:*.juhuasuan.com, DNS:*.lw.aliimg.com, DNS:*.m.1688.com, DNS:*.m.alibaba.com, DNS:*.m.alitrip.com, DNS:*.m.cainiao.com, DNS:*.m.etao.com, DNS:*.m.taobao.com, DNS:*.m.taopiaopiao.com, DNS:*.m.tmall.com, DNS:*.m.tmall.hk, DNS:*.mei.com, DNS:*.taopiaopiao.com, DNS:*.tmall.hk, DNS:*.trip.taobao.com, DNS:*.xiami.com, DN DNS:feizhu.cn, DNS:feizhu.com, DNS:fliggy.com, DNS:fliggy.hk, DNS:juhuasuan.com, DNS:mei.com, DNS:taobao.com, DNS:taopiaopiao.com, DNS:tmall.hk, DNS:xiami.com, DNS:tmall.com, DNS:*.cloudvideocdn.taobao.com, DNS:cloudvideocdn.taobao.com, DNS:tbcdn.cn
npm ERR! gyp ERR! stack at new NodeError (node:internal/errors:372:5)
npm ERR! gyp ERR! stack at Object.checkServerIdentity (node:tls:346:12)
npm ERR! gyp ERR! stack at TLSSocket.onConnectSecure (node:_tls_wrap:1542:27)
npm ERR! gyp ERR! stack at TLSSocket.emit (node:events:527:28)
npm ERR! gyp ERR! stack at TLSSocket._finishInit (node:_tls_wrap:946:8)
npm ERR! gyp ERR! stack at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:727:12)
npm ERR! gyp ERR! System Windows_NT 10.0.19045
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\src\\atguigu-course-master\\course-mobile\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd D:\src\atguigu-course-master\course-mobile\node_modules\node-sass
npm ERR! gyp ERR! node -v v17.9.1
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\win10\AppData\Local\npm-cache\_logs\2025-01-27T06_36_52_476Z-debug-0.log
PS D:\src\atguigu-course-master\course-mobile> npm uninstall node-sass
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm WARN deprecated osenv@0.1.5: This package is no longer supported.
npm WARN deprecated npmlog@4.1.2: This package is no longer supported.
npm WARN deprecated glob@7.1.7: Glob versions prior to v9 are no longer supported
npm WARN deprecated are-we-there-yet@1.1.7: This package is no longer supported.
npm WARN deprecated gauge@2.7.4: This package is no longer supported.
npm WARN deprecated fstream@1.0.12: This package is no longer supported.
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm WARN deprecated node-sass@4.14.1: Node Sass is no longer supported. Please use `sass` or `sass-embedded` instead.
added 1 package, and removed 7 packages in 12s
133 packages are looking for funding
为此尝试安装python2.7 node 18.15.0,其实应该仔细看
node-sass@4.14.1: Node Sass is no longer supported. Please use `sass` or `sass-embedded` instead.
参考: