7

I've added two libraries to my package.json

  "devDependencies": {
    ...
    "react-dom/test-utils": "*",
    "react-test-renderer/shallow": "*"
  },

as suggested by react docs to be compliant with version 16 of react ecosystem.

After running npm install --verbose I got this:

18 verbose node v8.5.0
19 verbose npm  v5.3.0
20 error code EINVALIDPACKAGENAME
21 error Invalid package name "react-dom/test-utils": name can only contain URL-friendly characters
22 verbose exit [ 1, true ]

Also trying to install it as devDependency via cli gives this error:

npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t ssh://[email protected]/react-dom/test-utils.git
npm ERR! 
npm ERR! Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR! 
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR! 
npm ERR! exited with error code: 128

How can I solve this to have those packages available for referencing in the code?

2
  • the things you call packages could not be packages, they cannot be named like that. Npm packages cannot contain slash in the name unless it is a scopes package starting from @ symbol Commented Oct 24, 2017 at 14:24
  • @smnbbrv so how can I use something like react-dom/test-utils in the import statement them? Commented Oct 24, 2017 at 14:26

1 Answer 1

15

Add react-dom as a dependency: npm install --save react-dom

When you import react-dom/test-utils it means: import from the test-utils folder/file which is in the react-dom package.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.