Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 'Must use npm@>=5' while using npm 5.4.2 #25

Closed
ixje opened this issue Oct 3, 2017 · 2 comments
Closed

Error 'Must use npm@>=5' while using npm 5.4.2 #25

ixje opened this issue Oct 3, 2017 · 2 comments

Comments

@ixje
Copy link

ixje commented Oct 3, 2017

Eriks-Air:neonwallet erik$ ./node_modules/.bin/patch-package react-navigation

ERROR No package-lock.json, npm-shrinkwrap.json, or yarn.lock file.

You must use either npm@>=5, yarn, or npm-shrinkwrap to manage this project's
dependencies.

Eriks-Air:neonwallet erik$ npm -v
5.4.2

Also likely related:

Eriks-Air:neonwallet erik$ npm -v
5.4.2
Eriks-Air:neonwallet erik$ grep "prepare" package.json
"prepare": "patch-package"
Eriks-Air:neonwallet erik$ npm prepare -- react-navigation

Usage: npm

where is one of:
access, adduser, bin, bugs, c, cache, completion, config,
ddp, dedupe, deprecate, dist-tag, docs, doctor, edit,
explore, get, help, help-search, i, init, install,
install-test, it, link, list, ln, login, logout, ls,
outdated, owner, pack, ping, prefix, prune, publish, rb,
rebuild, repo, restart, root, run, run-script, s, se,
search, set, shrinkwrap, star, stars, start, stop, t, team,
test, tst, un, uninstall, unpublish, unstar, up, update, v,
version, view, whoami

npm -h quick help on
npm -l display full usage info
npm help search for help on
npm help npm involved overview

Specify configs in the ini-formatted file:
/Users/erik/.npmrc
or on the command line via: npm --key value
Config info can be viewed via: npm help config

npm@5.4.2 /usr/local/lib/node_modules/npm

I've followed all the instructions as far as I can see. I also can't really tell why it's failing. Any help/tips are appreciated

@ds300
Copy link
Owner

ds300 commented Oct 3, 2017

Thanks for the report!

npm prepare -- react-navigation should be npm run prepare -- react-navigation

That's my bad, the README is wrong. I'll update it now.

As for the first issue, that's a new one. The error message is a little misleading. It implies that you might be using an old npm but really it just means that it can't find any lock files. Do you definitely have one? i.e. a package-lock.json, npm-shrinkwrap.json, or yarn.lock? If so, then perhaps you could do me a favour:

  1. edit node_modules/patch-package/dist/detectPackageManager.js and put the following line at the top of the detectPackageManager function:

    console.log("app root path:", appRootPath)
    
  2. Then re-run patch-package and let me know whether the value that is logged is different from the root folder of your project (where the package.json is)?

@ixje
Copy link
Author

ixje commented Oct 4, 2017

Got it working. What happened is that I was on npm 4.3.0 when I tried to use the package. I updated to npm >= 5 and did not touch any packages since then. It turns out that the lock file is not generated until you at least once touch the node_modules or package.json

In their words:

package-lock.json is automatically generated for any operations where npm modifies either the node_modules tree, or package.json.

After removing and reinstalling a package it could run and created a patch file :)

@ixje ixje closed this as completed Oct 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants