繁体   English   中英

我无法通过 vue-cli 使用 (vue-router, vuex, node-sass, babel, pwa, eslint) 创建 Vue 项目

[英]I can't create a Vue project with (vue-router, vuex, node-sass, babel, pwa, eslint) through vue-cli

我正在使用以下

Windows 10
@vue/cli - 3.12.1
node - 16.2.0

a 选择了问题中的特征

vue-router, vuex, node-sass, babel, pwa, eslint 

尝试运行命令时:

vue create projeto_plugins

我尝试了很多东西,经过大量调试、安装和卸载后,我陷入了这个错误:

npm ERR! code 1
npm ERR! path D:\projetos\CursoVueJS\vue-cli\projeto-plugins\node_modules\fibers
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! Compilando os projetos desta solu��o um de cada vez. Para habilitar o build paralelo, adicione a op��o "/m".
npm ERR! C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets\Microsoft.Cpp.WindowsSDK.targets(46,5): error MSB8036: The Windows SDK version 10.0.17763.0 was not found. Install the required 
version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution". [D:\projetos\CursoVueJS\vue-cli\projeto-plugins\node_modules\fibers\build\fibers.vcxproj]
npm ERR! (node:15384) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onExit (D:\projetos\CursoVueJS\vue-cli\projeto-plugins\node_modules\node-gyp\lib\build.js:262:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:365:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Windows_NT 10.0.18363
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\projetos\\CursoVueJS\\vue-cli\\projeto-plugins\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd D:\projetos\CursoVueJS\vue-cli\projeto-plugins\node_modules\fibers
npm ERR! gyp ERR! node -v v16.2.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Bruno\AppData\Local\npm-cache\_logs\2021-07-13T20_27_50_955Z-debug.log
 ERROR  command failed: npm install --loglevel error

该项目实际上已创建,但是当我尝试运行时:

npm run serve

我得到:

 ERROR  Failed to compile with 7 errors                                                                                                                                                                                  17:30:04
These dependencies were not found:

* register-service-worker in ./src/registerServiceWorker.js
* vue in ./src/main.js, ./src/components/HelloWorld.vue and 1 other
* vue-router in ./src/router.js
* vuex in ./src/store.js

To install them, you can run: npm install --save register-service-worker vue vue-router vuex
Failed to resolve loader: sass-loader
You may need to install it.

所以我尝试通过安装sass-loader

npm install -g sass-loader

我得到:

npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup   [
npm WARN cleanup     undefined,
npm WARN cleanup     AssertionError [ERR_ASSERTION]: rimraf: missing path
npm WARN cleanup         at rimraf (C:\Program Files\nodejs\node_modules\npm\node_modules\rimraf\rimraf.js:54:3)
npm WARN cleanup         at node:internal/util:335:7
npm WARN cleanup         at new Promise (<anonymous>)
npm WARN cleanup         at rimraf (node:internal/util:321:12)
npm WARN cleanup         at C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:452:20
npm WARN cleanup         at Array.map (<anonymous>)
npm WARN cleanup         at Arborist.[rollbackCreateSparseTree] (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:452:8)
npm WARN cleanup         at C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:892:50
npm WARN cleanup         at processTicksAndRejections (node:internal/process/task_queues:96:5)
npm WARN cleanup         at async Arborist.[reifyPackages] (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:212:11) {
npm WARN cleanup       generatedMessage: false,
npm WARN cleanup       code: 'ERR_ASSERTION',
npm WARN cleanup       actual: undefined,
npm WARN cleanup       expected: true,
npm WARN cleanup       operator: '=='
npm WARN cleanup     }
npm WARN cleanup   ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path C:\Users\Bruno\AppData\Roaming\npm\node_modules\fibers
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! Compilando os projetos desta solu��o um de cada vez. Para habilitar o build paralelo, adicione a op��o "/m".
npm ERR! C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets\Microsoft.Cpp.WindowsSDK.targets(46,5): error MSB8036: The Windows SDK version 10.0.17763.0 was not found. Install the required 
version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution". [C:\Users\Bruno\AppData\Roaming\npm\node_modules\fibers\build\fibers.vcxproj]npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@16.2.0 | win32 | x64
npm ERR! gyp info find Python using Python version 2.7.9 found at "C:\Python27\python.exe"
npm ERR! gyp info find VS using VS2017 (15.9.28307.960) found at:
npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! (node:17500) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp info spawn C:\Python27\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'msvs',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\Bruno\\AppData\\Roaming\\npm\\node_modules\\fibers\\build\\config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\Bruno\\AppData\\Local\\node-gyp\\Cache\\16.2.0\\include\\node\\common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=C:\\Users\\Bruno\\AppData\\Local\\node-gyp\\Cache\\16.2.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\Bruno\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\16.2.0\\\\<(target_arch)\\\\node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\Bruno\\AppData\\Roaming\\npm\\node_modules\\fibers',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'C:\\Users\\Bruno\\AppData\\Roaming\\npm\\node_modules\\fibers\\build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'build/binding.sln',
npm ERR! gyp info spawn args   '/clp:Verbosity=minimal',
npm ERR! gyp info spawn args   '/nologo',
npm ERR! gyp info spawn args   '/p:Configuration=Release;Platform=x64'
npm ERR! gyp info spawn args ]
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:365:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Windows_NT 10.0.18363
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\Bruno\AppData\Roaming\npm\node_modules\fibers
npm ERR! gyp ERR! node -v v16.2.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Bruno\AppData\Local\npm-cache\_logs\2021-07-13T20_31_57_262Z-debug.log

有人可以帮我吗?

检查您的 node-sass 版本是否与您的节点版本匹配: https://www.npmjs.com/package/node-sass/v/6.0.1

您还可以通过运行来检查:

 npm install --ignore-scripts

然后转到 node_modules\fibers\bin 文件夹。 检查你那里有哪个版本的 win32 二进制文件。 最后一个数字是节点模块版本。 例如,如果您找到 win32-x64-83,则需要节点 v14 或者,按照说明创建一个工作的node-gyp 构建环境 并尝试从 vs 2017 命令提示符运行 npm 命令。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM