我无法运行npm install cmd来创建从GitHub克隆的SharePoint Online SPFx Web部件解决方案。
我的环境:
node -v
v16.18.0
npm list --depth=0 -g
C:\Users\laptop\AppData\Roaming\npm
+-- @microsoft/generator-sharepoint@1.15.2
+-- gulp-cli@2.3.0
+-- gulp@4.0.2
+-- node-gyp@9.3.0
+-- windows-build-tools@5.2.2
`-- yo@4.3.0
我错过了这里的npm安装
Visual Studio 2022是一款基于Visual Studio 2022开发的软件,它可以帮助您开发出一款基于Visual Studio 2022的软件。
这是Git存储库https://github.com/pnp/sp-dev-fx-webparts以及我想要部署的所需Web部件https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-organization-chart
当我运行npm安装时(不管是什么项目,就像我从GitHub尝试的其他项目一样,我得到了以下错误,我不知道问题是出在我的设备上还是出在我正在使用的Git仓库上。
PS C:\sp-dev-fx-webparts\samples\react-organization-chart> npm install
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 EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: '@microsoft/office-ui-fabric-react-bundle@1.12.1',
npm WARN EBADENGINE required: { node: '>=12.13.0 <13.0.0 || >=14.15.0 <15.0.0' },
npm WARN EBADENGINE current: { node: 'v16.18.0', npm: '8.19.2' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: '@microsoft/sp-office-ui-fabric-core@1.12.1',
npm WARN EBADENGINE required: { node: '>=12.13.0 <13.0.0 || >=14.15.0 <15.0.0' },
npm WARN EBADENGINE current: { node: 'v16.18.0', npm: '8.19.2' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: '@microsoft/sp-tslint-rules@1.12.1',
npm WARN EBADENGINE required: { node: '>=12.13.0 <13.0.0 || >=14.15.0 <15.0.0' },
npm WARN EBADENGINE current: { node: 'v16.18.0', npm: '8.19.2' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: 'karma@0.13.22',
npm WARN EBADENGINE required: { node: '0.10 || 0.12 || 4 || 5' },
npm WARN EBADENGINE current: { node: 'v16.18.0', npm: '8.19.2' }
npm WARN EBADENGINE }
npm WARN deprecated @types/log4js@2.3.5: This is a stub types definition for log4js (https://github.com/nomiddlename/log4js-node). log4js provides its own type definitions, so you don't need @types/log4js installed!
npm WARN deprecated read-package-tree@5.1.6: The functionality that this package provided is now in @npmcli/arborist
npm WARN deprecated natives@1.1.6: This module relies on Node.js's internals and will break at some point. Do not use it, and update to graceful-fs@4.x.
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
npm WARN deprecated @types/adal@1.0.27: '@types/adal' is now '@types/adal-angular'
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated json3@3.3.2: Please use the native JSON object instead of JSON 3
npm WARN deprecated gulp-karma@0.0.5: gulp-karma has been deprecated, use Karma directly instead
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated chokidar@1.7.0: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated browserslist@1.3.6: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated cryptiles@2.0.5: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated graceful-fs@1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated acorn-dynamic-import@2.0.2: This is probably built in to whatever tool you're using. If you still need it... idk
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated formatio@1.1.1: This package is unmaintained. Use @sinonjs/formatio instead
npm WARN deprecated es6-collections@0.5.6: not actively maintained anymore
npm WARN deprecated sane@1.6.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated samsam@1.1.2: This package has been deprecated in favour of @sinonjs/samsam
npm WARN deprecated boom@2.10.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated gulp-open@2.0.0: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated sntp@1.0.9: This module moved to @hapi/sntp. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm WARN deprecated formidable@1.2.2: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes:
npm WARN deprecated gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated phantomjs-prebuilt@2.1.16: this package is now deprecated
npm WARN deprecated uuid@3.1.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated hoek@2.16.3: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated gulp-util@2.2.20: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm WARN deprecated gulp-util@2.2.20: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm WARN deprecated request@2.69.0: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated tar@3.1.15: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm WARN deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated har-validator@2.0.6: this library is no longer supported
npm WARN deprecated hawk@3.1.3: This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated connect@2.30.2: connect 2.x series is deprecated
npm WARN deprecated superagent@3.8.3: Please upgrade to v7.0.2+ of superagent. We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing. See the releases tab for more information at <https://github.com/visionmedia/superagent/releases>.
npm WARN deprecated spfx-uifabric-themes@0.8.5: spfx-uifabric-themes will not be maintained in future - checkout https://my.n8d.at/htwoo
npm WARN deprecated istanbul@0.4.5: This module is no longer maintained, try this instead:
npm WARN deprecated npm i nyc
npm WARN deprecated Visit https://istanbul.js.org/integrations for other alternatives.
npm WARN deprecated svgo@0.7.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated log4js@0.6.38: 0.x is no longer supported. Please upgrade to 6.x or higher.
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 azure-storage@0.10.0: Please note: newer packages @azure/storage-blob, @azure/storage-queue and @azure/storage-file are available as of November 2019 and @azure/data-tables is available as of June 2021. While the legacy azure-storage package will continue to receive critical bug fixes, we strongly encourage you to upgrade. Migration guide can be found: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/MigrationGuide.md
npm WARN deprecated tslint@6.1.3: TSLint has been deprecated in favor of ESLint. Please see https://github.com/palantir/tslint/issues/4534 for more information.
npm WARN deprecated core-js@1.2.7: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code 1
npm ERR! path C:\sp-dev-fx-webparts\samples\react-organization-chart\node_modules\deasync
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node ./build.js
npm ERR! Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
npm ERR! C:\sp-dev-fx-webparts\samples\react-organization-chart\node_modules\deasync\build\deasync.vcxproj(20,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.18.0 | win32 | x64
npm ERR! gyp http GET https://nodejs.org/download/release/v16.18.0/node-v16.18.0-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.18.0/node-v16.18.0-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v16.18.0/SHASUMS256.txt
npm ERR! gyp http GET https://nodejs.org/download/release/v16.18.0/win-x64/node.lib
npm ERR! gyp http GET https://nodejs.org/download/release/v16.18.0/win-x86/node.lib
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.18.0/SHASUMS256.txt
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.18.0/win-x86/node.lib
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.18.0/win-x64/node.lib
npm ERR! (node:10848) [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:\Users\laptop\.windows-build-tools\python27\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'C:\\sp-dev-fx-webparts\\samples\\react-organization-chart\\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 '-G',
npm ERR! gyp info spawn args 'msvs_version=2015',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\\sp-dev-fx-webparts\\samples\\react-organization-chart\\node_modules\\deasync\\build\\config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\\sp-dev-fx-webparts\\samples\\react-organization-chart\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\\Users\\laptop\\.node-gyp\\16.18.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\\laptop\\.node-gyp\\16.18.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=C:\\sp-dev-fx-webparts\\samples\\react-organization-chart\\node_modules\\node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=C:\\Users\\laptop\\.node-gyp\\16.18.0\\<(target_arch)\\node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=C:\\sp-dev-fx-webparts\\samples\\react-organization-chart\\node_modules\\deasync',
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:\\sp-dev-fx-webparts\\samples\\react-organization-chart\\node_modules\\deasync\\build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\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:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onExit (C:\sp-dev-fx-webparts\samples\react-organization-chart\node_modules\node-gyp\lib\build.js:262:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm ERR! gyp ERR! System Windows_NT 10.0.22621
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\sp-dev-fx-webparts\\samples\\react-organization-chart\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\sp-dev-fx-webparts\samples\react-organization-chart\node_modules\deasync
npm ERR! gyp ERR! node -v v16.18.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed
有人能帮忙吗,我已经挣扎了三天,运行各种命令来解决这个问题,但没有工作:
我用过:npm install --global --production windows-build-tools
,但三个小时后什么也没发生,它被卡在reify:ajv: timing reifyNode:node_modules/windows-build-tools Completed in 364ms
[安装卡住][3]
如果我终止作业(三小时后),我将得到以下结果
npm install --global --production windows-build-tools
>> C:\sp-dev-fx-webparts\samples\react-organization-chart>
npm WARN config production Use `--omit=dev` instead.
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated windows-build-tools@5.2.2: Node.js now includes build tools for Windows. You probably no longer need this tool. See https://github.com/felixrieseberg/windows-build-tools for details.
npm ERR! code 3221225786
npm ERR! path C:\Users\laptop\AppData\Roaming\npm\node_modules\windows-build-tools
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node ./dist/index.js
Downloading python-2.7.15.amd64.msi
npm ERR! [============================================>] 100.0% (0 B/s)
npm ERR! Downloaded python-2.7.15.amd64.msi. Saved to C:\Users\laptop\.windows-build-tools\python-2.7.15.amd64.msi.
Downloading vs_BuildTools.exe
npm ERR! [============================================>] 100.0% (0 B/s)
npm ERR! Downloaded vs_BuildTools.exe. Saved to C:\Users\laptop\.windows-build-tools\vs_BuildTools.exe.
npm ERR!
npm ERR! Starting installation...
npm ERR! Launched installers, now waiting for them to finish.
npm ERR! This will likely take some time - please be patient!
npm ERR!
npm ERR! Status from the installers:
---------- Visual Studio Build Tools ----------
npm ERR! Still waiting for installer log file...
npm ERR! ------------------- Python --------------------
npm ERR! Successfully installed Python 2.7
npm ERR! ^C
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\laptop\AppData\Local\npm-cache\_logs\2022-10-19T10_01_35_030Z-debug-0.log
同时运行set VCTargetsPath=%programfiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\V140
1条答案
按热度按时间5lhxktic1#
在改变节点的安装版本后,它对我起作用了。我安装了节点版本10. 13. 0和@microsoft/generator-sharepoint@1.10.0,它起作用了。你可以使用NVM(https://github.com/nvm-sh/nvm)在你的计算机上安装多个版本的节点,并在它们之间切换。