- 刚开始安装了node.js
-
然后我就去执行了 npm install
-
然后就报了下面一堆的错
-
然后我就把镜像换成了淘宝的镜像
npm get registry https://registry.npmjs.org/(npm默认镜像源) npm config set registry https://registry.npm.taobao.org
-
然后还安装了一个cnpm,然后执行 cnpm install 结果又报错
-
然后看到网上说,可能是因为npm的版本太高,不能用7.XX,要降到6.XX,于是我降了版本
win+R 输入 npm-v 是否版本号大于等于7,使用: npm install -g npm@6 进行版本回退
降完版本后:
- 再次执行cnpm install,出现如下错误
Not Found - GET https://registry.npm.taobao.org/@types/strip-json-comments/-/strip-json-comments-0.0 - 换成执行npm install
gyp verb check python checking for Python executable "python2" in the PATH gyp verb `which` failed Error: not found: python2 gyp verb check python checking for Python executable "python" in the PATH gyp verb `which` succeeded python C:Program FilesPython36python.EXE gyp verb check python version `C:Program FilesPython36python.EXE -c "import platform; print(platform.python_version());"` returned: "3.6.4rn" gyp verb could not find "C:Program FilesPython36python.EXE". checking python launcher gyp verb could not find "C:Program FilesPython36python.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:Program FilesPython36python.EXE", you can set the PYTHON env variable.解决办法:
There is another workaround to this error:
- Delete your folder.node_modules
- Run in your command prompt. npm install --global windows-build-tools --save
- Install node-sass using the command: (or the latest version)npm install node-sass@4.12.0 --save
完了又出现如下错误:
1 先删除 node_modules 文件夹,不然运行的时候可能会报错
2 手动下载chromedriver的压缩包,放在一个地方(我这里放在了桌面)下载地址:
https://cdn.npm.taobao.org/dist/chromedriver/2.27/chromedriver_win32.zip
3、执行下面命令:
npm install chromedriver --chromedriver_filepath=C:Users314niuniuDesktopchromedriver_win32.zip
驱动安装好了
- 到这里看似完事大吉,浏览器启动起来,也开始编译代码了,可谁曾想到,编译到最后又报了node-nass的错误,我一看头都炸了,这错误不就是最初的时候一直报的跟他有关的错嘛,一夜又回到解放前了?
报错信息如下:
Building: C:Program Filesnodejsnode.exe E:blog_webvue-admin-template-masternode_modulesnode-gypbinnode-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli 'C:\Program Files\nodejs\node.exe',
gyp verb cli 'E:\blog_web\vue-admin-template-master\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 verb cli ]
gyp info using node-gyp@3.8.0
gyp info using node@12.18.2 | win32 | x64
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 (E:blog_webvue-admin-template-masternode_moduleswhichwhich.js:13:12)
gyp verb `which` failed at F (E:blog_webvue-admin-template-masternode_moduleswhichwhich.js:68:19)
gyp verb `which` failed at E (E:blog_webvue-admin-template-masternode_moduleswhichwhich.js:80:29)
gyp verb `which` failed at E:blog_webvue-admin-template-masternode_moduleswhichwhich.js:89:16
gyp verb `which` failed at E:blog_webvue-admin-template-masternode_modulesisexeindex.js:42:5
gyp verb `which` failed at E:blog_webvue-admin-template-masternode_modulesisexewindows.js:36:5
gyp verb `which` failed at FSReqCallback.oncomplete (fs.js:167:21)
gyp verb `which` failed python2 Error: not found: python2
gyp verb `which` failed at getNotFoundError (E:blog_webvue-admin-template-masternode_moduleswhichwhich.js:13:12)
gyp verb `which` failed at F (E:blog_webvue-admin-template-masternode_moduleswhichwhich.js:68:19)
gyp verb `which` failed at E (E:blog_webvue-admin-template-masternode_moduleswhichwhich.js:80:29)
gyp verb `which` failed at E:blog_webvue-admin-template-masternode_moduleswhichwhich.js:89:16
gyp verb `which` failed at E:blog_webvue-admin-template-masternode_modulesisexeindex.js:42:5
gyp verb `which` failed at E:blog_webvue-admin-template-masternode_modulesisexewindows.js:36:5
gyp verb `which` failed at FSReqCallback.oncomplete (fs.js:167:21) {
gyp verb `which` failed code: 'ENOENT'
gyp verb `which` failed }
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 (E:blog_webvue-admin-template-masternode_moduleswhichwhich.js:13:12)
gyp verb `which` failed at F (E:blog_webvue-admin-template-masternode_moduleswhichwhich.js:68:19)
gyp verb `which` failed at E (E:blog_webvue-admin-template-masternode_moduleswhichwhich.js:80:29)
gyp verb `which` failed at E:blog_webvue-admin-template-masternode_moduleswhichwhich.js:89:16
gyp verb `which` failed at E:blog_webvue-admin-template-masternode_modulesisexeindex.js:42:5
gyp verb `which` failed at E:blog_webvue-admin-template-masternode_modulesisexewindows.js:36:5
gyp verb `which` failed at FSReqCallback.oncomplete (fs.js:167:21)
gyp verb `which` failed python Error: not found: python
gyp verb `which` failed at getNotFoundError (E:blog_webvue-admin-template-masternode_moduleswhichwhich.js:13:12)
gyp verb `which` failed at F (E:blog_webvue-admin-template-masternode_moduleswhichwhich.js:68:19)
gyp verb `which` failed at E (E:blog_webvue-admin-template-masternode_moduleswhichwhich.js:80:29)
gyp verb `which` failed at E:blog_webvue-admin-template-masternode_moduleswhichwhich.js:89:16
gyp verb `which` failed at E:blog_webvue-admin-template-masternode_modulesisexeindex.js:42:5
gyp verb `which` failed at E:blog_webvue-admin-template-masternode_modulesisexewindows.js:36:5
gyp verb `which` failed at FSReqCallback.oncomplete (fs.js:167:21) {
gyp verb `which` failed code: 'ENOENT'
gyp verb `which` failed }
gyp verb could not find "python". checking python launcher
gyp verb could not find "python". guessing location
gyp verb ensuring that file exists: C:Python27python.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 PythonFinder.failNoPython (E:blog_webvue-admin-template-masternode_modulesnode-gyplibconfigure.js:484:19)
gyp ERR! stack at PythonFinder. (E:blog_webvue-admin-template-masternode_modulesnode-gyplibconfigure.js:509:16)
gyp ERR! stack at callback (E:blog_webvue-admin-template-masternode_modulesgraceful-fspolyfills.js:295:20)
gyp ERR! stack at FSReqCallback.oncomplete (fs.js:167:21)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\Program Files\nodejs\node.exe" "E:\blog_web\vue-admin-template-master\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd E:blog_webvue-admin-template-masternode_modulesnode-sass
gyp ERR! node -v v12.18.2
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN notsup Unsupported engine for watchpack-chokidar2@2.0.0: wanted: {"node":"<8.10.0"} (current: {"node":"12.18.2","npm":"6.14.5"})
npm WARN notsup Not compatible with your version of node/npm: watchpack-chokidar2@2.0.0
npm WARN script-ext-html-webpack-plugin@2.0.1 requires a peer of html-webpack-plugin@^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN vue-admin-template@3.8.0 No repository field.
npm WARN optional SKIPPING OPTIonAL DEPENDENCY: fsevents@1.2.13 (node_moduleswebpack-dev-servernode_modulesfsevents):
npm WARN notsup SKIPPING OPTIonAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIonAL DEPENDENCY: fsevents@1.2.13 (node_moduleswatchpack-chokidar2node_modulesfsevents):
npm WARN notsup SKIPPING OPTIonAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIonAL DEPENDENCY: fsevents@2.1.3 (node_modulesfsevents):
npm WARN notsup SKIPPING OPTIonAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.14.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.14.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersMACHENIKEAppDataRoamingnpm-cache_logs2020-07-07T15_30_39_533Z-debug.log
- 谁曾想到,又执行了如下两行命令
1、npm install -g mirror-config-china --registry=http://registry.npm.taobao.org 2、npm install node-sass
- 再次执行 npm run dev 竟然神奇的好了
终于大功告成,完结撒花


