React-native: react native init throwing error ERR_INVALID_ARG_TYPE(name, 'string', value)

Created on 22 Mar 2019  路  37Comments  路  Source: facebook/react-native

Hello, I am having some issue with react native init for creating a new project. The error is something like
wqeqweasadad

just executing react-native init projectName
project creation failed wth
` internal/validators.js:125
throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
at validateString (internal/validators.js:125:11)

`

node v11.10.0
npm 6.7.0
yarn 1.13.0

Bug Ran Commands Locked

Most helpful comment

It works with previous versions:

react-native init --version "0.58.6"

All 37 comments


Thanks for submitting your issue. Can you take another look at your description and make sure the issue template has been filled in its entirety?

馃憠 Click here if you want to take another look at the Bug Report issue template.

i have met this problem too,looked up the stack trace it seems that PackageManager.projectDir is not set 馃槩

I really don't understand. What's wrong !!!! Is that the react-native cli causing this problem. I am just hanged up don't know and can't find

I'm too. Yesterday was working fine, but now give this error. I tried to put a package.json file and run "npm i", but when i run the app, it doesn't recognize the AVD

same problem here, just can't start a new project

Have same issue:
node v11.12.0
npm 6.7.0

info Adding required dependencies
internal/validators.js:125
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined

this is how my package.json looked after the react-native init command:

{
  "name": "answers",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start"
  },
  "dependencies": {
    "react-native": "0.59.1"
  }
}

It works with previous versions:

react-native init --version "0.58.6"

It works with previous versions:

react-native init --version "0.58.6"

worked pretty well

Yes working thanks a lot but there are some issues with 0.59 version of react native.
I am not closing the issue because it's going to be fixed right!!!?

I don't think the problem is with the version 0.59.1, I think it is with some dependency, two days ago I've used the 0.59 and it worked fine.

Just about 2-3 hours ago it stopped working. I'm using 0.59.1 almost a month now 馃槦馃槦

Just got the same error, confirmed.

Screen Shot 2019-03-23 at 10 07 58
the same here ...

same here, I am stuck with this error since the morning .

Same problem here

Same here.

Same for me too

Same for me

This error is occurring since this morning. I'm using the 0.59.1 about a month.

I am using "react" 16.8.3 in my old project with "0.59.1" react-native. But when I try to create a new project with 0.59.1, "yarn" tries to create with version 16.8.5 of "react". I checked the "CHANGELOG" of the "react" and realized that a new version was released 10 hours ago. Can this be related? (sorry for my bad english)

It works with previous versions:

react-native init --version "0.58.6"

it worked with the old version

Same error here

same problem happens with node 10 and 11 here.

Looks like it's probably related to @react-native-community/cli being updated 7 hours ago.

react-native-community/react-native-cli#260

If you're looking for a quick solution can edit a file in node modules: react-native-community/react-native-cli@0c00895 and re-run the command. It worked for me.

reference: https://github.com/facebook/react-native/issues/24108#issuecomment-475822529

I am having the exact same issue !!

馃槶 馃槶 馃槶 馃槶

Done in 191.71s.
info Setting up new React Native app in D:\WorkSpace\awesomeApp
info Adding required dependencies
path.js:39
    throw new ERR_INVALID_ARG_TYPE('path', 'string', path);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
    at assertPath (path.js:39:11)
    at Object.join (path.js:432:7)
    at isProjectUsingYarn (D:\WorkSpace\awesomeApp\node_modules\@react-native-community\cli\build\tools\yarn.js:101:51)
    at shouldUseYarn (D:\WorkSpace\awesomeApp\node_modules\@react-native-community\cli\build\tools\PackageManager.js:36:39)
    at Object.install (D:\WorkSpace\awesomeApp\node_modules\@react-native-community\cli\build\tools\PackageManager.js:44:10)
    at generateProject (D:\WorkSpace\awesomeApp\node_modules\@react-native-community\cli\build\commands\init\init.js:111:18)
    at Object.init (D:\WorkSpace\awesomeApp\node_modules\@react-native-community\cli\build\commands\init\init.js:94:3)
    at run (C:\Users\Zaki\AppData\Roaming\npm\node_modules\react-native-cli\index.js:302:7)
    at createProject (C:\Users\Zaki\AppData\Roaming\npm\node_modules\react-native-cli\index.js:249:3)
    at init (C:\Users\Zaki\AppData\Roaming\npm\node_modules\react-native-cli\index.js:200:5)

Reason:

projectDir in node_modules/@react-native-community/cli/build/tools/PackageManager.js isundefined

related files:

./packages/cli/src/commands/init/init.js

image

Same issue here. Any update?

It works with previous versions:

react-native init --version "0.58.6"

Thank you soo much !!

馃槝馃槝

You saved my life !! 馃槀馃槀

Same Problem

Same for me too. 馃槶 馃槶 馃槶 馃槶

any idea abt this issue ?

It seems that some dependencies has updated. I have initialed react-native 0.59.0-rc3 project last week successfully. But now failed, too.

I am having the Exact Same issue as above mentioned

info Setting up new React Native app in C:\Users\ZohaibAhmad\AwesomeProjec
info Adding required dependencies
internal/validators.js:125
throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
at validateString (internal/validators.js:125:11)
at Object.join (path.js:427:7)
at isProjectUsingYarn (C:\Users\ZohaibAhmad\AwesomeProjec\node_modules\@react-native-community\cli\build\tools\yarn.js:101:51)
at shouldUseYarn (C:\Users\ZohaibAhmad\AwesomeProjec\node_modules\@react-native-community\cli\build\tools\PackageManager.js:36:39)
at Object.install (C:\Users\ZohaibAhmad\AwesomeProjec\node_modules\@react-native-community\cli\build\tools\PackageManager.js:44:10)
at generateProject (C:\Users\ZohaibAhmad\AwesomeProjec\node_modules\@react-native-community\cli\build\commands\init\init.js:111:18)
at Object.init (C:\Users\ZohaibAhmad\AwesomeProjec\node_modules\@react-native-community\cli\build\commands\init\init.js:94:3)
at run (C:\Users\ZohaibAhmad\AppData\Roaming\npm\node_modules\react-native-cli\index.js:302:7)
at createProject (C:\Users\ZohaibAhmad\AppData\Roaming\npm\node_modules\react-native-cli\index.js:249:3)
at init (C:\Users\ZohaibAhmad\AppData\Roaming\npm\node_modules\react-native-cli\index.js:200:5)

@ZohaibAhmad786 try this solution

It will resolve the issue on hand 馃槆馃槆

@ZohaibAhmad786 try this solution
It will resolve the issue on hand 馃槆馃槆

Thanks it's Work with 0.58.6

Apologies for the troubles. We are shipping a fix to this right now. This is a regression inside CLI due to recent refactor. Will be fixed soon.

Whoa, this blew up. Fix published in transitive dep (@react-native-community/cli) so it should work just fine now. Sorry for the wait!

Was this page helpful?
0 / 5 - 0 ratings