Closed mustafahlvc closed 4 years ago
This issue reproduces on master:
Error: expect(received).not.toContain(expected) // indexOf
Expected substring: not "Undeclared dependency on example"
Received string: "➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed in 5.71s
➤ YN0000: ┌ Fetch step
➤ YN0013: │ @nodelib/fs.scandir@npm:2.1.3 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @nodelib/fs.stat@npm:2.0.3 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @nodelib/fs.walk@npm:1.2.4 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @sindresorhus/is@npm:1.2.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @szmarczak/http-timer@npm:4.0.5 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @types/cacheable-request@npm:6.0.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @types/http-cache-semantics@npm:4.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @types/keyv@npm:3.1.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @types/node@npm:13.7.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @types/responselike@npm:1.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @types/semver@npm:6.2.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/cli@npm:2.0.0-rc.28 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/core@npm:2.0.0-rc.22 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/doctor@npm:2.0.0-rc.14 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/fslib@npm:2.0.0-rc.15 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/json-proxy@npm:2.0.0-rc.7 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/libui@npm:2.0.0-rc.7 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/libzip@npm:2.0.0-rc.9 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/parsers@npm:2.0.0-rc.9 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/plugin-compat@npm:2.0.0-rc.6 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/plugin-constraints@npm:2.0.0-rc.12 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/plugin-dlx@npm:2.0.0-rc.12 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/plugin-essentials@npm:2.0.0-rc.22 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/plugin-file@npm:2.0.0-rc.12 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/plugin-git@npm:2.0.0-rc.16 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/plugin-github@npm:2.0.0-rc.13 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/plugin-http@npm:2.0.0-rc.11 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/plugin-init@npm:2.0.0-rc.12 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/plugin-link@npm:2.0.0-rc.11 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/plugin-node-modules@npm:2.0.0-rc.5 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/plugin-npm-cli@npm:2.0.0-rc.14 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/plugin-npm@npm:2.0.0-rc.15 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/plugin-pack@npm:2.0.0-rc.17 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/plugin-patch@npm:2.0.0-rc.4 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/plugin-pnp@npm:2.0.0-rc.16 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/plugin-stage@npm:2.0.0-rc.15 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/plugin-version@npm:2.0.0-rc.20 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/pnp@npm:2.0.0-rc.16 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/pnpify@npm:2.0.0-rc.17 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @yarnpkg/shell@npm:2.0.0-rc.8 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ any-promise@npm:1.3.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ array-union@npm:2.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ arrify@npm:2.0.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ astral-regex@npm:2.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ auto-bind@npm:4.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ bl@npm:3.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ cacheable-lookup@npm:1.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ cacheable-request@npm:7.0.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ cli-cursor@npm:2.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ cli-truncate@npm:2.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ clipanion@npm:2.1.6 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ clone-response@npm:1.0.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ commander@npm:2.12.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ comment-json@npm:2.4.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ decompress-response@npm:5.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ defer-to-connect@npm:2.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ diff@npm:4.0.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ dir-glob@npm:3.0.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ duplexer3@npm:0.1.4 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ end-of-stream@npm:1.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ fast-glob@npm:3.1.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ fastq@npm:1.6.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ figures@npm:2.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ fn-name@npm:2.0.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ fs-constants@npm:1.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ get-stream@npm:5.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ git-up@npm:4.0.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ git-url-parse@npm:11.1.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ globby@npm:10.0.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ got@npm:10.4.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ has-own-prop@npm:2.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ http-cache-semantics@npm:4.0.3 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ ignore@npm:5.1.4 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ ink@npm:2.7.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ inquirer@npm:6.5.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ is-ssh@npm:1.3.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ is@npm:3.3.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ js-reporters@npm:1.2.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ json-buffer@npm:3.0.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ json-file-plus@npm:3.3.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ keyv@npm:4.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ lodash.throttle@npm:4.1.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ lodash.toarray@npm:4.4.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ log-update@npm:3.4.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ logic-solver@npm:2.0.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ lowercase-keys@npm:2.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ micromatch@npm:4.0.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ mimic-fn@npm:1.2.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ mimic-response@npm:1.0.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ mimic-response@npm:2.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ mute-stream@npm:0.0.7 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ node-emoji@npm:1.10.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ node-watch@npm:0.6.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ node.extend@npm:2.0.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ normalize-url@npm:4.5.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ once@npm:1.3.3 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ onetime@npm:2.0.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ p-cancelable@npm:2.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ parse-path@npm:4.0.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ parse-url@npm:5.0.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ pluralize@npm:7.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ promise-deferred@npm:2.0.3 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ promise.prototype.finally@npm:3.1.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ promise@npm:7.3.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ promiseback@npm:2.0.3 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ property-expr@npm:1.5.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ protocols@npm:1.4.7 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ qunit@npm:2.9.3 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ react-reconciler@npm:0.24.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ readline-sync@npm:1.4.9 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ redux@npm:4.0.5 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ resolve@npm:1.9.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ resolve@patch:resolve@npm%3A1.9.0#builtin<compat/resolve>::version=1.9.0&hash=8fccd0 can't be found in the cache and will be fetched from the disk
➤ YN0013: │ responselike@npm:2.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ restore-cursor@npm:2.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ reusify@npm:1.0.4 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ run-parallel@npm:1.1.9 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ slice-ansi@npm:3.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ stream-buffers@npm:3.0.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ stream-to-array@npm:2.3.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ stream-to-promise@npm:2.2.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ symbol-observable@npm:1.2.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ synchronous-promise@npm:2.0.10 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ tar-stream@npm:2.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ tau-prolog@npm:0.2.80 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ to-readable-stream@npm:2.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ toposort@npm:2.0.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ treeify@npm:1.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ tunnel@npm:0.0.6 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ type-fest@npm:0.9.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ typescript@npm:3.7.5 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ typescript@patch:typescript@npm%3A3.7.5#builtin<compat/typescript>::version=3.7.5&hash=273569 can't be found in the cache and will be fetched from the disk
➤ YN0013: │ underscore@npm:1.9.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ widest-line@npm:3.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ wrap-ansi@npm:6.2.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yoga-layout-prebuilt@npm:1.9.3 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yup@npm:0.27.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0000: └ Completed in 38.55s
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed in 0.79s
➤ YN0000: Done in 45.09s
➤ YN0000: Found 1 package(s) to process
➤ YN0000: For a grand total of 7 file(s) to validate
➤ YN0000: ┌ /tmp/tmp-27FlAy5vSpcYkM/test/package.json
➤ YN0000: │ /tmp/tmp-27FlAy5vSpcYkM/test/src/App.jsx:2:1: Undeclared dependency on example
➤ YN0000: │ /tmp/tmp-27FlAy5vSpcYkM/test/package.json:8:36: Unmet transitive peer dependency on @testing-library/dom@>=5, via @testing-library/user-event@^7.1.2
➤ YN0000: │ /tmp/tmp-27FlAy5vSpcYkM/test/package.json:11:22: Unmet transitive peer dependency on typescript@^3.2.1, via react-scripts@3.3.1
➤ YN0000: └ Completed in 0.94s
➤ YN0000: Failed with errors in 0.94s
"
at module.exports (evalmachine.<anonymous>:34:20)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async /github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-2.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:56:13
at async executeInTempDirectory (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-2.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:17:16)
at async Object.executeRepro (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-2.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:24:12)
at async ExecCommand.execute (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-2.zip/node_modules/@arcanis/sherlock/lib/commands/exec.js:25:38)
at async ExecCommand.validateAndExecute (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-2.zip/node_modules/clipanion/lib/advanced/Command.js:161:26)
at async Cli.run (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-2.zip/node_modules/clipanion/lib/advanced/Cli.js:74:24)
at async Cli.runExit (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-2.zip/node_modules/clipanion/lib/advanced/Cli.js:83:28)
@arcanis Any thoughts on this?
I'll close it as "not a bug". There is no way for the doctor to know about such aliases without hardcoding the logic for CRA, which is the wrong way to go about this.
There is a fix, but it needs to be applied by project. Check this section for details. In short, just use the project name (ie the one defined in the name
field from your package.json
) instead of app
, and everything will work just fine.
@arcanis Thanks for that. And if we don't use specific things around the "name" in the package.json. i.e.
import { foo } from 'test-helpers';
import { bar } from 'test-helpers/enzyme';
import { baz } from 'api/v1-client';
What would you recommend?
@arcanis Can you elaborate a little on what the resolution is. I read the link but it's not entirely clear.
If I understand correctly I shall need to do a batch replace of every absolute import in my package.
e.g. import { useContextValue } from 'components/context/tableContext'
=> import { useContextValue } from 'my-package-name/components/context/tableContext'
Would i need to remove baseUrl
from compilerOptions
and the include
array?
VSCode import will not automatically add this suffix so for every new import I will need to manually add, which will be a pain
I came across this issue because I'm trying to use SvelteKit and it has $app
imports. I solved it by adding the following to my package.json:
"dependencies": {
"$app": "link:./nope",
"$lib": "link:./nope",
// rest of the dependencies
}
./nope
doesn't exist, but it doesn't seem to matter. I found this pattern by searching Github https://github.com/search?q=path%3Apackage.json+%22link%3A%22&type=code
https://github.com/yarnpkg/berry/issues/889#issuecomment-622946996
@arcanis hello, the link on above comment is 404, could you give me another valid link for the docs? thanks.
And same error occurs for imports using subpath import, like
/Users/{username}/my-app/services/szs/src/libs/GuidePage.tsx:9:1: Undeclared dependency on #domains
Is this also intended or bug?
I'll close it as "not a bug". There is no way for the doctor to know about such aliases without hardcoding the logic for CRA, which is the wrong way to go about this.
There is a fix, but it needs to be applied by project. Check this section for details. In short, just use the project name (ie the one defined in the
name
field from yourpackage.json
) instead ofapp
, and everything will work just fine.
My aliases begin with an @ example:
"@project-name/utils": ["libs/utils/src"],
"@project-name/utils/*": ["libs/utils/src/*"],
So I am unable to set that name in package.json
because it's an invalid pattern.
Is there any way around this?
Describe the bug
I m using absolute imports as described at https://create-react-app.dev/docs/importing-a-component/#absolute-imports
To Reproduce
Afer running
yarn dlx @yarnpkg/doctor
all absolute imports reported "Undeclared dependency"This is my reproduction case:
Environment if relevant (please complete the following information):