Error installing react-draggable npm and cannot be installed.

Asked 1 years ago, Updated 1 years ago, 90 views

When I tried to install a package called react-draggable on an existing React project, an error occurred and I am having trouble installing it.

Run Commands

Executed the following command:
npm install react-draggable

An error occurred during this time.
The error message is described later in Error Message

Other events that may have been previously associated

The ^4.0.0-alpha.57 in the error message is the version of @material-ui/lab that was previously installed and worked on, so it seems to be related.
The reason I did this was that if the package.json version remains *, an error occurred during the GitHub Actions build.
The changes are as follows.

package.json

"@material-ui/lab": "*", // Before change (on installation)
    "@material-ui/lab": "^4.0.0-alpha.57", // Changed

package-lock.json

"version": "4.0.0-alpha.57", // Before change (on installation)
      "version": "^4.0.0-alpha.57", // After change

プロジェクトThe project name has been replaced by {Project Name} and the user name has been replaced by {User Name}.

VSCode Terminal

MyMacBookAir: {project name} {username} $npm install react-draggable
npm ERR!Invalid Version: ^4.0.0-alpha.57

US>npm ERR!A complete log of this run can be found in:
npm ERR!/Users/{username}/.npm/_logs/2021-04-26T06_50_54_272Z-debug.log

2021-04-26T06_50_54_272Z-debug.log Contents

 0 verbose cli [
0 verbose cli'/Users/{username}/.nodebrew/node/v14.15.5/bin/node',
0 verbose cli'/Users/{username}/.nodebrew/current/bin/npm',
0 verbose cli 'install',
0 verbose cli 'react-draggable'
0 verbose cli]
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnodeCompleted in 2ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:/Users/{username}/.nodebrew/node/v14.15.5/lib/node_modules/npm/npmrc Completed in 4ms
6 timing config:load:buildin Completed in 4ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 0ms
9timing config:load:file:/Users/{User Name}/Documents/Sandbox/{Project Name}/.npmrc Completed in 2ms
10 timing config:load:project Completed in 4ms
11 timing config:load:file:/Users/{username}/.npmrc Completed in 5ms
12 timing config:load:user Completed in 5ms
13 timing config:load:file:/Users/{username}/.nodebrew/node/v14.15.5/etc/npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:setEnvs Completed in 2ms
17 timing config —load Completed in 20 ms
18 timing npm:load:configload Completed in 20ms
19 timing npm:load:setTitle Completed in 0ms
20 timing npm:load:setupLog Completed in 3ms
21 timing npm:load:cleanupLog Completed in 2ms
22 timing npm:load:configScope Completed in 0ms
23 timing npm:load:projectScope Completed in 1ms
24 timing npm: load Completed in 30ms
25 timing config:load:flatten Completed in 3ms
26 timing arborist:ctor Completed in 1ms
27 timing idealTree: init Completed in 1489ms
28 timing idealTree: userRequests Completed in 4ms
29 silly idealTree buildDeps
30 silly fetch manifest@material-ui/lab@^4.0.0-alpha.57
31 timing arborist:ctor Completed in 0ms
32 http fetch GET 304 https://registry.npmjs.org/ @material-ui%2flab1711ms (from cache)
33 silly fetch manifest@material-ui/core@latest
34 http fetch GET 304 https://registry.npmjs.org/ @material-ui%2fcore 103ms (from cache)
35 silly fetch manifest@types/react@^16.8.6||^17.0.0
36 http fetch GET 304 https://registry.npmjs.org/ @types%2fract98ms (from cache)
37 silly fetch manifest react@latest
38 http fetch GET 304 https://registry.npmjs.org/react 59ms (from cache)
39 silly fetch manifest react-dom@latest
40 http fetch GET 304 https://registry.npmjs.org/react-dom 59ms (from cache)
41 silly fetch manifest react-draggable@*
42 http fetch GET 304 https://registry.npmjs.org/react-draggable 628ms (from cache)
43 timing idealTree Completed in 4210ms
44 timing command: install Completed in 4238ms
45 verbose stack TypeError: Invalid Version: ^4.0.0 - alpha.57
45 verbose stack at new SemVer (/Users/{username}/.nodebrew/node/v14.15.5/lib/node_modules/npm/node_modules/semver/classes/semver.js:38:13)
45 verbose stack at compare (/Users/{username}/.nodebrew/node/v14.15.5/lib/node_modules/npm/node_modules/semver/functions/compare.js:32)
45 verbose stack at Object.gte (/Users/{username}/.nodebrew/node/v14.15.5/lib/node_modules/npm/node_modules/semver/functions/gte.js:2:30)
45 verbose stack at Arborist. [canPlaceDep] (/Users/{username}/.nodebrew/node/14.5/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js: 1552:53)
45 verbose stack at Arborist. [placeDep] (/Users/{username}/.nodebrew/node/14.5/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1277:36)
45 verbose stack at /Users/{username}/.nodebrew/node/v14.15.5/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:904:46
45 verbose stack at Array.map (<anonymous>)
45 verbose stack at Arborist. [buildDepStep] (/Users/{username}/.nodebrew/node/14.5/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:904:8)
45 verbose stack at async Arborist.buildIdealTree(/Users/{username}/.nodebrew/node/v14.15.5/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:217)
45 verbose stack at async Promise.all (index1)
46 verbose cwd / Users / {username} / Documents / Sandbox / {project name}
47 verbose Darwin 20.3.0
48 verbose argv"/Users/{username}/.nodebrew/node/v14.15.5/bin/node""/Users/{username}/.nodebrew/current/bin/npm""install"""react-dragable"
49 verbose node v14.15.5
50 verbose npm v7.8.0
51 error Invalid Version: ^4.0.0-alpha.57
52 verbose exit 1

That's all.
Thank you for your cooperation.

reactjs npm material-ui

2022-09-29 20:28

1 Answers

There is a secondary problem, not a fundamental solution, but the problem in the title will be solved, so we have addressed it below.
We will continue to look for better solutions and reasons.

@material-ui/lab package specification changed from * because npm ci&npm runbuild of GitHub Actions failed again.

The error details are as follows:

npm ERR!cipm can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install`before continuing.
US>npm ERR! 
US>npm ERR! 
npm ERR!Invalid: lock file's @material-ui/lab @4.0.0-alpha.57 does not satify @material-ui/lab@*
US>npm ERR! 

US>npm ERR!A complete log of this run can be found in:
npm ERR!/home/runner/.npm/_logs/2021-04-26T08_08_31_976Z-debug.log
Error: Process completed with exit code 1.


2022-09-29 20:28

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.