Nativescript-cli: ENOENT: no such file or directory, lstat /nativescript/node_modules/fsevents/package.json'

Created on 4 Sep 2018  Â·  10Comments  Â·  Source: NativeScript/nativescript-cli

_From @IAMtheIAM on September 3, 2018 17:56_

Every single time I add, update, or remove any package.json dependency, nativescript fails to compile with this error

Executing before-prepareJSApp hook from /nativescript/hooks/before-prepareJSApp/nativescript-dev-webpack.js
Unable to apply changes on device: emulator-5554. Error is: ENOENT: no such file or directory, lstat /nativescript/node_modules/fsevents/package.json'.

I always have to delete node_modules and reinstall - why?

On Linux Mint 19

Which platform(s) does your issue occur on?

Android

Please provide the following version numbers that your issue occurs with:

  • CLI: (run tns --version to fetch it) 4.2.3
  • Cross-platform modules: (check the 'version' attribute in the 4.2.0
    node_modules/tns-core-modules/package.json file in your project)
  • Runtime(s): (look for the "tns-android" and "tns-ios" properties in the
    package.json file of your project) 4.2.0
  • Plugin(s): (look for the version number in the package.json file of your
    project)

_Copied from original issue: NativeScript/NativeScript#6235_

question linux

All 10 comments

I am getting same error after installed new version of NativeScript 5.1.1.

Unable to apply changes on device: D7437733-7F30-4690-B238-26B5C9F2B39E. Error is: Processing node_modules failed. Error: ENOENT: no such file or directory, open '/Users/jibon/openroadenglish/platforms/ios/openroadenglish/app/tns_modules/npm/node_modules/request/node_modules/.bin/package.json'.

I ran npm un npm --save but still error:

Processing node_modules failed. Error: ENOENT: no such file or directory, open '/Users/jibon/openroadenglish/platforms/ios/openroadenglish/app/tns_modules/npm/node_modules/request/node_modules/.bin/package.json'

Please give me suggestion.

Hey @jibon57 ,
Can you please try deleting your platforms and node_modules folders and try tns run <platform> after that ?

@rosen-vladimirov thanks for reply. I tried that several time but still getting same error :( . I even tried to remove nodejs completely following: https://stackoverflow.com/a/11178106/1281864 & reinstalled but still same error :( :(

Hey @jibon57 ,
Can you please send us your package.json? Also, did you remove package-lock.json before executing tns run ...?

package.json

 "dependencies": {
    "@angular/animations": "~7.1.0",
    "@angular/common": "~7.1.0",
    "@angular/compiler": "~7.1.0",
    "@angular/core": "~7.1.0",
    "@angular/forms": "~7.1.0",
    "@angular/http": "~7.1.0",
    "@angular/platform-browser": "~7.1.0",
    "@angular/platform-browser-dynamic": "~7.1.0",
    "@angular/router": "~7.1.0",
    "moment": "^2.23.0",
    "nativescript-angular": "^7.1.2",
    "nativescript-baidu-push-notifications": "^1.0.4",
    "nativescript-cardview": "^3.1.1",
    "nativescript-carousel": "^4.1.0",
    "nativescript-cfalert-dialog": "^1.0.14",
    "nativescript-clipboard": "^1.1.7",
    "nativescript-fancyalert": "^3.0.6",
    "nativescript-image-cache-it": "^4.1.1",
    "nativescript-insomnia": "^1.2.2",
    "nativescript-permissions": "^1.2.3",
    "nativescript-secure-storage": "^2.3.0",
    "nativescript-sqlite": "^2.3.0",
    "nativescript-theme-core": "~1.0.4",
    "nativescript-toasty": "^1.2.0",
    "nativescript-ui-calendar": "^3.10.0",
    "nativescript-ui-listview": "^5.1.1",
    "nativescript-ui-sidedrawer": "^5.1.0",
    "nativescript-webview-interface": "^1.4.2",
    "npm-check-updates": "^2.15.0",
    "reflect-metadata": "~0.1.10",
    "rxjs": "^6.3.3",
    "tns-core-modules": "^5.1.2",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~7.1.0",
    "@nativescript/schematics": "~0.5.0",
    "@ngtools/webpack": "~7.1.0",
    "nativescript-dev-sass": "~1.6.0",
    "nativescript-dev-typescript": "~0.7.9",
    "nativescript-dev-webpack": "^0.19.0",
    "typescript": "~3.1.1"
  }

This time I ran
rm -rf hooks node_modules platforms package-lock.json
then
npm install
tns build ios
but error:
Processing node_modules failed. Error: ENOENT: no such file or directory, open '/Users/jibon/openroadenglish/platforms/ios/openroadenglish/app/tns_modules/npm/node_modules/request/node_modules/.bin/package.json'

✔ Getting NativeScript components versions information...
✔ Component nativescript has 5.1.1 version and is up to date.
✔ Component tns-core-modules has 5.1.2 version and is up to date.
✔ Component tns-android has 5.1.0 version and is up to date.
✔ Component tns-ios has 5.1.1 version and is up to date.

Oh! npm-check-updates has been added by mistake. Let me try to remove it.

Thanks for sharing your package. It looks like you have installed npm-check-updates as dependency. In the dependencies section you must install only the packages that you'll use at runtime of your application (i.e. on device). npm-check-updates should be installed as devDependency and it should resolve your issue.

@rosen-vladimirov thank you so much! Yes, after removing npm-check-updates it's working now 💯

@jibon57 , I'm glad it worked.
As the initial issue seems the same - nativescript package is installed as a dependency of the project, but it should be installed globally, not as a direct dependency of the project, so I'm closing this thread.

An unhandled exception occurred: ENOENT: no such file or directory, lstat 'C:UsersFRANCISOneDriveBureauPRATIQUEANGULAR1node_modules'
See "C:UsersFRANCISAppDataLocalTempng-nkvthYangular-errors.log" for further details.

Was this page helpful?
0 / 5 - 0 ratings