Cli: Fails: react-native init helloworld --version 0.59.10

Created on 25 Jul 2019  路  18Comments  路  Source: react-native-community/cli

Environment

> react-native --version
react-native-cli: 2.0.1
react-native: n/a - not inside a React Native project directory

Description

react-native init helloworld --version 0.59.10

fails with:

...
鈹溾攢 [email protected]
鈹斺攢 [email protected]
Done in 7.36s.
internal/modules/cjs/loader.js:583
    throw err;
    ^

Error: Cannot find module '../../tools/PackageManager'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/home/titan/shared/tera/cloud9/tmp/tar/helloworld/node_modules/@react-native-community/cli/build/commands/install/install.js:10:46)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)

full log: https://gist.github.com/mindlapse/625ceece338c17954e32d96497290672

Reproducible Demo

react-native init helloworld --version 0.59.10

bug

Most helpful comment

Fixed in 1.11.2. Please update the @react-native-community/cli to the latest version.

All 18 comments

Issue appears on multiple npm versions, including npm@next and [email protected], and with node 10.16.0 (LTS)

Really struggling with this, experienced the same error on node v10.16.0 and node v12.7.0 with [email protected].

Affects react-native 0.59.0 to 0.59.10 that have the "@react-native-community/cli": "^1.2.1" dependency.

Does not impact react-native 0.60.0 and above with the "@react-native-community/cli": "^2.0.1" dependency.

This just started happening within the past 24 hours

we met with the same problem.

11:10:46 internal/modules/cjs/loader.js:638
11:10:46 throw err;
11:10:46 ^
11:10:46
11:10:46 Error: Cannot find module '../../tools/PackageManager'
11:10:46 at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
11:10:46 at Function.Module._load (internal/modules/cjs/loader.js:562:25)
11:10:46 at Module.require (internal/modules/cjs/loader.js:690:17)
11:10:46 at require (internal/modules/cjs/helpers.js:25:18)
11:10:46 at Object. (/node_modules/@react-native-community/cli/build/commands/install/install.js:10:46)
11:10:46 at Module._compile (internal/modules/cjs/loader.js:776:30)
11:10:46 at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
11:10:46 at Module.load (internal/modules/cjs/loader.js:653:32)
11:10:46 at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
11:10:46 at Function.Module._load (internal/modules/cjs/loader.js:585:3)

Gonna fix that once I have access to my workstation. In the meantime (and generally in future, global cli is unnecessary now) use npx: npx react-native init App -- version 0.59.10. It will use the latest cli with 0.59 template.

Thank you for the fast response! As expected, the same issue is appearing with npx react-native init App --version 0.59.10

Bummer, looks like npx is taking some local RN of yours instead of from network

Published a fix. Can you try again?

I'm seeing the same error (after removing package-lock.json, trying with npx and with the CLI, and npm cache clean --force, and then on another machine running a CircleCI build - same thing appears)

Does it happen with yarn?

Resolved this currently by forcing v1.10.0 of the library in package.json. Working fine with node v11.0.0 and npm v6.10.0

In a computer with ubuntu, I met with this problem.
But in a Mac, it works well.
I do not know whether it is related with computer system.

I do not use dependecy @react-native-community/cli and i have the same problem since i have donde rm -rf node_modules > npm install.
And i have other project that do not use @react-native-community/cli either and works.
(Or almost i do not see this dependency in my package.json)

We are facing the same issue, any hacks for now to get this running? I am on linux machine, using jenkins server to build a project.

Fixed in 1.11.2. Please update the @react-native-community/cli to the latest version.

thanks it worked now

same error delete node_modules and package-lock.json then update package.json
"dependencies": {
"react":"16.0.3 to
"react": "16.8.6",} and in scritps { "test":"jest" } => npm install --save , expo start it's working in my code

Was this page helpful?
0 / 5 - 0 ratings