Nativescript-cli: Processing node_modules failed. TypeError: Path must be a string. Received undefined

Created on 13 Jun 2016  路  6Comments  路  Source: NativeScript/nativescript-cli

Hello,

I have this error when I try to prepare, build or run :
Processing node_modules failed. TypeError: Path must be a string. Received undefined
I don't know where it comes from. I read on the internet that I may be caused by the version 6 of Node. As I was using 5.5.0, I thought I just had to down-grade, so I'm now in 4.4.5 but I still have this... strange error.

Any solution ?

question

Most helpful comment

Well now it works, I don't know why, I didn't change anything...
But I think that it may be interesting to find a real solution in case it occurs again.

All 6 comments

Hi @p4ulolol

In order to help you out in the best way possible please provide more information (the platform on which your are testing, the app package.json and the detailed error log that includes the line you have provided). I recommend that you follow this guidelines

Meanwhile check your tsconfig.json it should look like this

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es5",
        "sourceMap": true,
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "noEmitHelpers": true,
        "noEmitOnError": true
    },
    "exclude": [
        "node_modules",
        "platforms"
    ]
}

If the reason is not in the tsconfig.json check your package manager version (npm) with

npm -v

Apart from your Node.js version (btw v5.5 is supported) you should also make sure that you are using a supported npm version. Usually the npm version is bundled with the node.js instalation but in some occasions you can end up with anewer version that is not supported.

I'm testing on windows.
The package.json file is the default package.json when you create a new project using tns create .
I tried with NPM 2.15.5 on Node 4.4.5 and NPM 3.5.0 on Node 5.5.0.
Here is my tsconfig.json :

{
  "compilerOptions": {
    "target": "ES5",
    "module": "commonjs",
    "sourceMap": true
  },
  "exclude": [
    "node_modules",
    "scratch",
    "coverage"
  ]
}

And I don't know where to find the error log/exception report (the line I've provided is just my CMD output, and there is nothing else except "Sending exception report...")

Well now it works, I don't know why, I didn't change anything...
But I think that it may be interesting to find a real solution in case it occurs again.

Having the same problem on Ubuntu. I am using NPM 4.2.0 NODE 7.9.0.

I have tried to reinstall node, nativescript, other packages, Still not working.
Any solution?

Hey @bhushankumarl

Could you give detailed steps to reproduce? Also run your commands with --log trace and send us the output, so we can investigate.

Thanks!

Hello, @pkoleva I just clean everything one more time and try it with the same version. Now, It's working.

Was this page helpful?
0 / 5 - 0 ratings