npm install报错(The platform “win32“ is incompatible with this module)
问题背景最近入门Vue,那么使用了最新的nodejs和yarn和npm,使用vue-cli脚手架新建项目之后进行npm install / yarn install ,结果发现以下报错,报错信息非常费解,因为提示的是python2不适合当前平台?一脸问号。d:\workspace\vue\vue-studyλ yarn installyarn install v1.22.4info No lock
·
问题背景
最近入门Vue,那么使用了最新的nodejs
和yarn
和npm
,使用vue-cli
脚手架新建项目之后进行npm install / yarn install
,结果发现以下报错,报错信息非常费解,因为提示的是python2不适合当前平台
?一脸问号。
d:\workspace\vue\vue-study
λ yarn install
yarn install v1.22.4
info No lockfile found.
[1/4] Resolving packages...
warning babel-core > babel-runtime > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning babel-core > babel-register > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning css-loader > cssnano > autoprefixer > browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning css-loader > cssnano > postcss-merge-rules > browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning css-loader > cssnano > postcss-merge-rules > caniuse-api > browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning node-sass > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning node-sass > node-gyp > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning webpack > watchpack > watchpack-chokidar2 > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning webpack > watchpack > watchpack-chokidar2 > chokidar > fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning webpack > watchpack > watchpack-chokidar2 > chokidar > braces > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning webpack > watchpack > watchpack-chokidar2 > chokidar > braces > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning webpack-dev-server > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
[2/4] Fetching packages...
info fsevents@2.1.3: The platform "win32" is incompatible with this module.
info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "win32" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[-/3] ⠈ waiting...
[-/3] ⠁ waiting...
error d:\workspace\vue\vue-study\node_modules\node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments:
Directory: d:\workspace\vue\vue-study\node_modules\node-sass
Output:
Building: D:\software\nodejs\node.exe d:\workspace\vue\vue-study\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 [
gyp verb cli 'D:\\software\\nodejs\\node.exe',
gyp verb cli 'd:\\workspace\\vue\\vue-study\\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.1 | 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 (d:\workspace\vue\vue-study\node_modules\which\which.js:13:12)
gyp verb `which` failed at F (d:\workspace\vue\vue-study\node_modules\which\which.js:68:19)
gyp verb `which` failed at E (d:\workspace\vue\vue-study\node_modules\which\which.js:80:29)
gyp verb `which` failed at d:\workspace\vue\vue-study\node_modules\which\which.js:89:16
gyp verb `which` failed at d:\workspace\vue\vue-study\node_modules\isexe\index.js:42:5
gyp verb `which` failed at d:\workspace\vue\vue-study\node_modules\isexe\windows.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 (d:\workspace\vue\vue-study\node_modules\which\which.js:13:12)
gyp verb `which` failed at F (d:\workspace\vue\vue-study\node_modules\which\which.js:68:19)
gyp verb `which` failed at E (d:\workspace\vue\vue-study\node_modules\which\which.js:80:29)
gyp verb `which` failed at d:\workspace\vue\vue-study\node_modules\which\which.js:89:16
gyp verb `which` failed at d:\workspace\vue\vue-study\node_modules\isexe\index.js:42:5
gyp verb `which` failed at d:\workspace\vue\vue-study\node_modules\isexe\windows.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 (d:\workspace\vue\vue-study\node_modules\which\which.js:13:12)
gyp verb `which` failed at F (d:\workspace\vue\vue-study\node_modules\which\which.js:68:19)
gyp verb `which` failed at E (d:\workspace\vue\vue-study\node_modules\which\which.js:80:29)
gyp verb `which` failed at d:\workspace\vue\vue-study\node_modules\which\which.js:89:16
gyp verb `which` failed at d:\workspace\vue\vue-study\node_modules\isexe\index.js:42:5
gyp verb `which` failed at d:\workspace\vue\vue-study\node_modules\isexe\windows.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 (d:\workspace\vue\vue-study\node_modules\which\which.js:13:12)
gyp verb `which` failed at F (d:\workspace\vue\vue-study\node_modules\which\which.js:68:19)
gyp verb `which` failed at E (d:\workspace\vue\vue-study\node_modules\which\which.js:80:29)
gyp verb `which` failed at d:\workspace\vue\vue-study\node_modules\which\which.js:89:16
gyp verb `which` failed at d:\workspace\vue\vue-study\node_modules\isexe\index.js:42:5
gyp verb `which` failed at d:\workspace\vue\vue-study\node_modules\isexe\windows.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:\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 PythonFinder.failNoPython (d:\workspace\vue\vue-study\node_modules\node-gyp\lib\configure.js:484:19)
gyp ERR! stack at PythonFinder.<anonymous> (d:\workspace\vue\vue-study\node_modules\node-gyp\lib\configure.js:509:16)
gyp ERR! stack at callback (d:\workspace\vue\vue-study\node_modules\graceful-fs\polyfills.js:295:20)
gyp ERR! stack at FSReqCallback.oncomplete (fs.js:167:21)
gyp ERR! System Windows_NT 10.0.18363
gyp ERR! command "D:\\software\\nodejs\\node.exe" "d:\\workspace\\vue\\vue-study\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd d:\workspace\vue\vue-study\node_modules\node-sass
gyp ERR! node -v v12.18.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
网上说这个方法,但是实际上也没什么用
yarn config set ignore-engines true
解决方案
最终是通过管理员模式
运行控制台,可能要有些安装命令需要权限,普通运行无法安装,所以会卡主。
例如我用yarn,就使用以下的,如果是npm,就
yarn global add windows-build-tools
yarn install
npm请使用:
npm install windows-build-tools --g
npm install
更多推荐
已为社区贡献8条内容
所有评论(0)