TypeError: Path must be a string. Received undefined

I keep getting this error when I try to start a new project with:

ionic start newapp blank

I just upgraded ionic to v3, first of all I uninstalled the previous version and then I installed the new one.
I also tried with:

npm cache clean -f

But nothing changes, please help I don’t know what to do.

1 Like

Output of ionic info please.
Also complete error output of the command please.

Your environment has been set up for using Node.js 6.10.3 (ia32) and npm.

C:\Users\petruccini>ionic start newapp blank
TypeError: Path must be a string. Received undefined
at assertPath (path.js:7:11)
at Object.resolve (path.js:186:7)
at Project.BaseConfig (C:\Users\petruccini\AppData\Roaming\npm\node_modules
ionic\node_modules@ionic\cli-utils\dist\lib\config.js:27:30)
at Project (C:\Users\petruccini\AppData\Roaming\npm\node_modules\ionic\node_
modules@ionic\cli-utils\dist\lib\project.js:25:1)
at C:\Users\petruccini\AppData\Roaming\npm\node_modules\ionic\dist\index.js:
54:25
at next (native)
at fulfilled (C:\Users\petruccini\AppData\Roaming\npm\node_modules\ionic\dis
t\index.js:4:58)
This is the complete error

Sounds similar to this one here:

Still, please run ionic info in the project please and post the output here.

The thing is that ionic doesn’t let me create any project :confused:

Then outside the non-existant project :wink:

If you have to work: Uninstall Ionic CLI v3 and install v2.2.3 - this was stable and probably doesn’t have this problem.

1 Like

Your environment has been set up for using Node.js 6.10.3 (ia32) and npm.

C:\Users\petruccini>ionic start newapp blank
TypeError: Path must be a string. Received undefined
at assertPath (path.js:7:11)
at Object.resolve (path.js:186:7)
at Project.BaseConfig (C:\Users\petruccini\AppData\Roaming\npm\node_modules
ionic\node_modules@ionic\cli-utils\dist\lib\config.js:27:30)
at Project (C:\Users\petruccini\AppData\Roaming\npm\node_modules\ionic\node_
modules@ionic\cli-utils\dist\lib\project.js:25:1)
at C:\Users\petruccini\AppData\Roaming\npm\node_modules\ionic\dist\index.js:
54:25
at next (native)
at fulfilled (C:\Users\petruccini\AppData\Roaming\npm\node_modules\ionic\dis
t\index.js:4:58)
It shows the same error with “ionic info” sorry it takes long but i have to wait 10 minutes

Where does it output this? What command line are you using?

ionic -v then please, and cordova -v when you’re at it, too.

1 Like

cordova -v outputs 7.0.0
ionic -v outputs the same error as ionic info and ionic start…
I’m using node js command prompt but I’ve tried git bash and windows command prompt and I get the same error

Try powershell
Try running cmd as admin

1 Like

I have another idea re the error output you get: Please post the contents of your package.json.
If @ionic/app-scripts is <1.3.7 try upgrading this.

1 Like
{
  "_args": [
    [
      {
        "raw": "ionic",
        "scope": null,
        "escapedName": "ionic",
        "name": "ionic",
        "rawSpec": "",
        "spec": "latest",
        "type": "tag"
      },
      "C:\\Users\\petruccini"
    ]
  ],
  "_from": "ionic@latest",
  "_id": "ionic@3.0.0",
  "_inCache": true,
  "_location": "/ionic",
  "_nodeVersion": "7.9.0",
  "_npmOperationalInternal": {
    "host": "packages-12-west.internal.npmjs.com",
    "tmp": "tmp/ionic-3.0.0.tgz_1494357109652_0.7478015592787415"
  },
  "_npmUser": {
    "name": "dwieeb",
    "email": "dwieeb@gmail.com"
  },
  "_npmVersion": "4.2.0",
  "_phantomChildren": {},
  "_requested": {
    "raw": "ionic",
    "scope": null,
    "escapedName": "ionic",
    "name": "ionic",
    "rawSpec": "",
    "spec": "latest",
    "type": "tag"
  },
  "_requiredBy": [
    "#USER"
  ],
  "_resolved": "https://registry.npmjs.org/ionic/-/ionic-3.0.0.tgz",
  "_shasum": "eb21e8327a64eed2a70e74c97569738859a6ac8c",
  "_shrinkwrap": null,
  "_spec": "ionic",
  "_where": "C:\\Users\\petruccini",
  "author": {
    "name": "Ionic Team",
    "email": "hi@ionic.io",
    "url": "http://ionic.io"
  },
  "bin": {
    "ionic": "./bin/ionic"
  },
  "bugs": {
    "url": "https://github.com/driftyco/ionic-cli/issues"
  },
  "dependencies": {
    "@ionic/cli-utils": "1.0.0",
    "chalk": "^1.1.3",
    "minimist": "^1.2.0",
    "opn": "^4.0.2",
    "path-exists": "^3.0.0",
    "tar": "^2.2.1"
  },
  "description": "A tool for creating and developing Ionic Framework mobile apps.",
  "devDependencies": {
    "@types/chalk": "^0.4.31",
    "@types/minimist": "^1.2.0",
    "@types/opn": "^3.0.28",
    "@types/path-exists": "^1.0.29",
    "@types/tar": "^1.0.29"
  },
  "directories": {},
  "dist": {
    "shasum": "eb21e8327a64eed2a70e74c97569738859a6ac8c",
    "tarball": "https://registry.npmjs.org/ionic/-/ionic-3.0.0.tgz"
  },
  "engines": {
    "node": ">=6"
  },
  "files": [
    "bin/",
    "dist/"
  ],
  "homepage": "http://ionicframework.com/",
  "jest": {
    "moduleFileExtensions": [
      "ts",
      "js"
    ],
    "transform": {
      ".(ts)": "<rootDir>/../../node_modules/ts-jest/preprocessor.js"
    },
    "testRegex": "/__tests__/.*\\.(ts|js)$",
    "testResultsProcessor": "<rootDir>/../../node_modules/ts-jest/coverageprocessor.js"
  },
  "keywords": [
    "ionic",
    "ionic framework",
    "ionicframework",
    "mobile",
    "app",
    "hybrid",
    "cordova",
    "native",
    "phonegap"
  ],
  "license": "MIT",
  "main": "./dist/index.js",
  "maintainers": [
    {
      "name": "brandyscarney",
      "email": "brandy@ionic.io"
    },
    {
      "name": "drifty",
      "email": "max@drifty.com"
    },
    {
      "name": "drygh",
      "email": "drew.rygh@gmail.com"
    },
    {
      "name": "dwieeb",
      "email": "dwieeb@gmail.com"
    },
    {
      "name": "ericb",
      "email": "eric@hellouser.net"
    },
    {
      "name": "ionicjs",
      "email": "hi@ionicframework.com"
    },
    {
      "name": "jthoms1",
      "email": "jthoms1@gmail.com"
    },
    {
      "name": "tlancina",
      "email": "tim@ionic.io"
    }
  ],
  "name": "ionic",
  "optionalDependencies": {},
  "peerDependencies": {},
  "preferGlobal": true,
  "readme": "ERROR: No README data found!",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/driftyco/ionic-cli.git"
  },
  "scripts": {
    "build": "npm run clean && npm run build-ts && npm run build-js",
    "build-js": "npm run -s script-prepublish",
    "build-ts": "../../node_modules/.bin/tsc",
    "clean": "rm -rf ./dist",
    "lint": "../../node_modules/.bin/tslint -c ../../tslint.json 'src/**/*.ts'",
    "prepublish": "npm run build",
    "script-prepublish": "node ../../scripts/prepublish.js ionic",
    "test": "../../node_modules/.bin/jest",
    "watch": "npm run clean && ../../node_modules/.bin/concurrently -p '{name} ' -n 'TS,JS' -c 'cyan.bold,yellow.dim' 'npm run watch-ts' 'npm run watch-js'",
    "watch-js": "../../node_modules/.bin/cross-env IONIC_PREPUBLISH_PLUGIN_VERSION=${npm_package_version}-local 'npm run watch-js-chokidar'",
    "watch-js-chokidar": "../../node_modules/.bin/chokidar --silent 'dist/**/*.js' -c 'npm run build-js'",
    "watch-ts": "../../node_modules/.bin/tsc -w"
  },
  "types": "./dist/index.d.ts",
  "version": "3.0.0"
}

here is the package.json, running as administrator in powershell and on the cmd gives same resoult.

This seems to be the package.json of the Ionic CLI. We need to see the one of your project :wink:

What project :S? ionic doesn’t let me create a project

Damn, sorry. To much debugging for one day.

I hope the Github issue turns something up.

1 Like

Thanks for answering

I haven’t used Windows in 30 years, but is it possible that you have deleted what is the current working directory for the terminal you are using? On Unix, you can do that to yourself pretty easily (open one terminal, cd somewhere, open another terminal, rmdir that directory, go back to first terminal). I can imagine a situation like that causing errors like this.

That would be C:\Users\petruccini\ in his case - which exists. But this path does not really, really exist on Windows, that’s my guess as the cause.

1 Like

5 posts were split to a new topic: Error if i want to start a old App, but if i make a new one everthing works fine

Hi I am having this same issue. I get the same error after trying to use ionic cli commands.
Did you find the fix for this bug? Kindly update