Issue 1:
Is there an existing issue for this?

I have searched the existing issues

Current Behavior

I am unable to install a package (@jest/core) With a caret range (@jest/core@^27.0.1). When I do so, I get the notarget error.

Debug Log

0 verbose cli [
0 verbose cli '/Users/apple/.nvm/versions/node/v16.3.0/bin/node',
0 verbose cli '/Users/apple/.nvm/versions/node/v16.3.0/bin/npm',
0 verbose cli 'i',
0 verbose cli '@jest/core@^27.0.1'
0 verbose cli ]
1 info using npm@7.11.2
2 info using node@v16.3.0
3 timing npm:load:whichnode Completed in 1ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:/Users/apple/.nvm/versions/node/v16.3.0/lib/node_modules/npm/npmrc Completed in 2ms
6 timing config:load:builtin Completed in 2ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:/Users/apple/Sites/Projects/npm-bug-test/.npmrc Completed in 0ms
10 timing config:load:project Completed in 1ms
11 verbose config init.author.name Use `--init-author-name` instead.
12 verbose config init.author.email Use `--init-author-email` instead.
13 verbose config init.author.url Use `--init-author-url` instead.
14 verbose config init.license Use `--init-license` instead.
15 timing config:load:file:/Users/apple/.npmrc Completed in 2ms
16 timing config:load:user Completed in 2ms
17 timing config:load:file:/Users/apple/.nvm/versions/node/v16.3.0/etc/npmrc Completed in 0ms
18 timing config:load:global Completed in 1ms
19 timing config:load:validate Completed in 1ms
20 timing config:load:credentials Completed in 1ms
21 timing config:load:setEnvs Completed in 1ms
22 timing config:load Completed in 13ms
23 timing npm:load:configload Completed in 13ms
24 timing npm:load:setTitle Completed in 25ms
25 timing npm:load:setupLog Completed in 0ms
26 timing npm:load:cleanupLog Completed in 2ms
27 timing npm:load:configScope Completed in 0ms
28 timing npm:load:projectScope Completed in 0ms
29 timing npm:load Completed in 43ms
30 timing config:load:flatten Completed in 3ms
31 timing arborist:ctor Completed in 1ms
32 timing arborist:ctor Completed in 0ms
33 timing idealTree:init Completed in 14ms
34 timing idealTree:userRequests Completed in 5ms
35 silly idealTree buildDeps
36 silly fetch manifest @jest/core@^27.0.1
37 http fetch GET 200 https://registry.npmjs.org/@jest%2fcore 73ms (from cache)
38 silly placeDep ROOT @jest/core@ OK for: npm-bug-test@1.0.0 want: ^27.0.1
39 timing idealTree:#root Completed in 85ms
40 timing idealTree:node_modules/@jest/core Completed in 0ms
41 timing idealTree:buildDeps Completed in 86ms
42 timing idealTree:fixDepFlags Completed in 1ms
43 timing idealTree Completed in 107ms
44 timing command:install Completed in 119ms
45 verbose type range
46 verbose stack @jest/core: No matching version found for @jest/core@^27.0.1.
46 verbose stack at module.exports (/Users/apple/.nvm/versions/node/v16.3.0/lib/node_modules/npm/node_modules/npm-pick-manifest/index.js:209:23)
46 verbose stack at /Users/apple/.nvm/versions/node/v16.3.0/lib/node_modules/npm/node_modules/pacote/lib/registry.js:118:26
46 verbose stack at async Arborist.[nodeFromEdge] (/Users/apple/.nvm/versions/node/v16.3.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:946:19)
46 verbose stack at async Arborist.[buildDepStep] (/Users/apple/.nvm/versions/node/v16.3.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:892:11)
46 verbose stack at async Arborist.buildIdealTree (/Users/apple/.nvm/versions/node/v16.3.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:218:7)
46 verbose stack at async Promise.all (index 1)
46 verbose stack at async Arborist.reify (/Users/apple/.nvm/versions/node/v16.3.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:135:5)
46 verbose stack at async Install.install (/Users/apple/.nvm/versions/node/v16.3.0/lib/node_modules/npm/lib/install.js:137:5)
47 verbose cwd /Users/apple/Sites/Projects/npm-bug-test
48 verbose Darwin 16.7.0
49 verbose argv "/Users/apple/.nvm/versions/node/v16.3.0/bin/node" "/Users/apple/.nvm/versions/node/v16.3.0/bin/npm" "i" "@jest/core@^27.0.1"
50 verbose node v16.3.0
51 verbose npm v7.11.2
52 error code ETARGET
53 error notarget No matching version found for @jest/core@^27.0.1.
54 error notarget In most cases you or one of your dependencies are requesting
54 error notarget a package version that doesn't exist.
55 verbose exit 1

Expected Behavior

The correct package is installed.

Steps To Reproduce

Init npm – npm init

Run npm i @jest/core@^27.0.1

See error

Environment

OS: MacOS 10.12

Node: 16.3.0

npm: 7.11.2

Issue 2:
Is there an existing issue for this?

I have searched the existing issues

This issue exists in the latest npm version

I am using the latest npm

Current Behavior

The artifacts of a merge conflict (<<<< HEAD, ||||, ====, >>>>> <hash>) in a package-lock.json file were accidentally committed to my repository. Running npm ci succeeded with no issues, even though the version and integrity fields were duplicated in a JSON object, and non-JSON compliant text was present.

Expected Behavior

If the JSON in a package-lock.json file is malformed, I expect npm ci to exit with a non-zero exit code. That is the behavior of NPM v6.14.16, but not NPM v7 or v8.

Steps To Reproduce

In this environment, with this zip file extracted into an empty folder (contains a minimal package.json and package-lock.json to reproduce the bug).

With this config, using any NPM version more recent than 7.0.0.

Run npm ci.

And see that no error is reported.

If you install NPM < 7.0.0, like 6.14.16, running npm ci does throw an error.

Environment

npm: 8.5.1 (present starting in 7.0.0 up to 8.8.0)

Node.js: 14.19.1

OS Name: Ubuntu 20.04.4

System Model Name: Dell Precision 7560

npm config:

; "user" config from $HOME/.npmrc

(obfuscated):registry = "https://npm.pkg.github.com"
//npm.pkg.github.com/:_authToken = (protected)

; node bin location = /usr/bin/node
; cwd = $HOME/playground/npm-test
; HOME = /home/(user)
; Run `npm config ls -l` to show all defaults.