tns run android --bundle
给我以下错误:
无法在设备上应用更改: *。错误是:cp:无法创建目录' / platforms / android / app / src':没有此类文件或目录。
然后下一行是:
Stopping webpack watch
如果我删除platform文件夹,然后运行以上命令,则不会出现任何错误。
我已删除node_modules
,hooks
,platforms
文件夹,然后尝试运行但没有用。
我曾尝试将webpack升级到最新版本,但是没有用。
这是我的package.json
{
"nativescript": {
"id": "org.nativescript.cloint",
"tns-ios": {
"version": "4.2.0"
},
"tns-android": {
"version": "4.2.0"
}
},
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"repository": "<fill-your-repository-here>",
"scripts": {
"lint": "tslint \"src/**/*.ts\""
},
"dependencies": {
"@angular/animations": "~6.1.0",
"@angular/common": "~6.1.0",
"@angular/compiler": "~6.1.0",
"@angular/core": "~6.1.0",
"@angular/forms": "~6.1.0",
"@angular/http": "~6.1.0",
"@angular/platform-browser": "~6.1.0",
"@angular/platform-browser-dynamic": "~6.1.0",
"@angular/router": "~6.1.0",
"nativescript-angular": "~6.1.0",
"nativescript-camera": "^4.0.3",
"nativescript-iqkeyboardmanager": "^1.3.0",
"nativescript-permissions": "^1.2.3",
"nativescript-secure-storage": "^2.3.0",
"nativescript-snackbar": "^3.2.0",
"nativescript-theme-core": "~1.0.4",
"nativescript-ui-sidedrawer": "~4.3.0",
"nativescript-web-image-cache": "^4.2.6",
"reflect-metadata": "~0.1.10",
"rxjs": "~6.2.0",
"tns-core-modules": "~4.2.0",
"tns-platform-declarations": "^4.2.1",
"zone.js": "~0.8.18"
},
"devDependencies": {
"@angular/compiler-cli": "~6.1.0",
"@nativescript/schematics": "~0.3.0",
"@ngtools/webpack": "~6.2.0",
"codelyzer": "~4.3.0",
"nativescript-dev-sass": "~1.6.0",
"nativescript-dev-typescript": "~0.7.0",
"nativescript-dev-webpack": "^0.16.0",
"tslint": "~5.11.0",
"typescript": "~2.7.2"
},
"readme": "NativeScript Application"
}
主要问题是每次我需要删除平台文件夹才能运行项目。
运行tns run android --bundle
~/Projects/production/cloint [requests] $ tns run android --bundle
Skipping node_modules folder! Use the syncAllFiles option to sync files from this folder.
Searching for devices...
Starting Android emulator with image Nexus_5X_API_25
Waiting for emulator device initialization...
Executing before-liveSync hook from /Users/rahulgavande/Projects/production/cloint/hooks/before-liveSync/nativescript-angular-sync.js
Executing before-watchPatterns hook from /Users/rahulgavande/Projects/production/cloint/hooks/before-watchPatterns/nativescript-dev-sass.js
Executing before-watchPatterns hook from /Users/rahulgavande/Projects/production/cloint/hooks/before-watchPatterns/nativescript-dev-typescript.js
Executing before-watchPatterns hook from /Users/rahulgavande/Projects/production/cloint/hooks/before-watchPatterns/nativescript-dev-webpack.js
Executing before-watch hook from /Users/rahulgavande/Projects/production/cloint/hooks/before-watch/nativescript-dev-sass.js
Hook skipped because bundling is in progress.
Executing before-watch hook from /Users/rahulgavande/Projects/production/cloint/hooks/before-watch/nativescript-dev-typescript.js
Hook skipped because bundling is in progress.
Executing before-watch hook from /Users/rahulgavande/Projects/production/cloint/hooks/before-watch/nativescript-dev-webpack.js
Running webpack for Android...
clean-webpack-plugin: /Users/rahulgavande/Projects/production/cloint/platforms/android/app/src/main/assets/app/**/* has been removed.
File change detected. Starting incremental webpack compilation...
Webpack is watching the files…
Hash: 68c900ccb3e606cb9949
Version: webpack 4.6.0
Time: 24946ms
Built at: 2018-10-30 11:47:05
Asset Size Chunks Chunk Names
App_Resources/Android/src/main/res/drawable-xhdpi/baseline_arrow_back_white_18.png 171 bytes [emitted]
bundle.js 62.1 KiB bundle [emitted] bundle
1.js 6.48 KiB 1 [emitted]
2.js 69.6 KiB 2 [emitted]
vendor.js 5.05 MiB vendor [emitted] vendor
App_Resources/Android/app.gradle 549 bytes [emitted]
App_Resources/Android/src/.DS_Store 6 KiB [emitted]
App_Resources/Android/src/main/AndroidManifest.xml 1.36 KiB [emitted]
App_Resources/Android/src/main/res/drawable-hdpi/background.png 3.42 KiB [emitted]
App_Resources/Android/src/main/res/drawable-hdpi/baseline_add_white_18.png 150 bytes [emitted]
App_Resources/Android/src/main/res/drawable-hdpi/baseline_add_white_24.png 138 bytes [emitted]
App_Resources/Android/src/main/res/drawable-hdpi/baseline_add_white_36.png 158 bytes [emitted]
App_Resources/Android/src/main/res/drawable-hdpi/baseline_add_white_48.png 97 bytes [emitted]
App_Resources/Android/src/main/res/drawable-hdpi/baseline_arrow_back_white_18.png 160 bytes [emitted]
App_Resources/Android/src/main/res/drawable-hdpi/baseline_arrow_back_white_24.png 171 bytes [emitted]
App_Resources/Android/src/main/res/drawable-hdpi/baseline_arrow_back_white_36.png 176 bytes [emitted]
App_Resources/Android/src/main/res/drawable-hdpi/baseline_arrow_back_white_48.png 203 bytes [emitted]
App_Resources/Android/src/main/res/drawable-hdpi/icon.png 6.8 KiB [emitted]
App_Resources/Android/src/main/res/drawable-hdpi/logo.png 32.4 KiB [emitted]
App_Resources/Android/src/main/res/drawable-hdpi/menu.png 291 bytes [emitted]
App_Resources/Android/src/main/res/drawable-ldpi/background.png 1.31 KiB [emitted]
App_Resources/Android/src/main/res/drawable-ldpi/icon.png 3.23 KiB [emitted]
App_Resources/Android/src/main/res/drawable-ldpi/logo.png 9.95 KiB [emitted]
App_Resources/Android/src/main/res/drawable-ldpi/menu.png 213 bytes [emitted]
App_Resources/Android/src/main/res/drawable-mdpi/background.png 1.89 KiB [emitted]
App_Resources/Android/src/main/res/drawable-mdpi/baseline_add_white_18.png 102 bytes [emitted]
App_Resources/Android/src/main/res/drawable-mdpi/baseline_add_white_24.png 92 bytes [emitted]
App_Resources/Android/src/main/res/drawable-mdpi/baseline_add_white_36.png 138 bytes [emitted]
App_Resources/Android/src/main/res/drawable-mdpi/baseline_add_white_48.png 97 bytes [emitted]
App_Resources/Android/src/main/res/drawable-mdpi/baseline_arrow_back_white_18.png 128 bytes [emitted]
App_Resources/Android/src/main/res/drawable-mdpi/baseline_arrow_back_white_24.png 132 bytes [emitted]
App_Resources/Android/src/main/res/drawable-mdpi/baseline_arrow_back_white_36.png 171 bytes [emitted]
App_Resources/Android/src/main/res/drawable-mdpi/baseline_arrow_back_white_48.png 170 bytes [emitted]
App_Resources/Android/src/main/res/drawable-mdpi/icon.png 3.42 KiB [emitted]
App_Resources/Android/src/main/res/drawable-mdpi/logo.png 15.8 KiB [emitted]
App_Resources/Android/src/main/res/drawable-mdpi/menu.png 235 bytes [emitted]
App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml 304 bytes [emitted]
App_Resources/Android/src/main/res/drawable-xhdpi/background.png 5.26 KiB [emitted]
App_Resources/Android/src/main/res/drawable-xhdpi/baseline_add_white_18.png 138 bytes [emitted]
App_Resources/Android/src/main/res/drawable-xhdpi/baseline_add_white_24.png 97 bytes [emitted]
App_Resources/Android/src/main/res/drawable-xhdpi/baseline_add_white_36.png 97 bytes [emitted]
App_Resources/Android/src/main/res/drawable-xhdpi/baseline_add_white_48.png 102 bytes [emitted]
0.js 11.8 KiB 0 [emitted]
App_Resources/Android/src/main/res/drawable-xhdpi/baseline_arrow_back_white_24.png 170 bytes [emitted]
App_Resources/Android/src/main/res/drawable-xhdpi/baseline_arrow_back_white_36.png 203 bytes [emitted]
App_Resources/Android/src/main/res/drawable-xhdpi/baseline_arrow_back_white_48.png 261 bytes [emitted]
App_Resources/Android/src/main/res/drawable-xhdpi/icon.png 10.4 KiB [emitted]
App_Resources/Android/src/main/res/drawable-xhdpi/logo.png 54 KiB [emitted]
App_Resources/Android/src/main/res/drawable-xhdpi/menu.png 297 bytes [emitted]
App_Resources/Android/src/main/res/drawable-xxhdpi/background.png 10.3 KiB [emitted]
App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_add_white_18.png 158 bytes [emitted]
App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_add_white_24.png 97 bytes [emitted]
App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_add_white_36.png 186 bytes [emitted]
App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_add_white_48.png 113 bytes [emitted]
App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_arrow_back_white_18.png 176 bytes [emitted]
App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_arrow_back_white_24.png 203 bytes [emitted]
App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_arrow_back_white_36.png 253 bytes [emitted]
App_Resources/Android/src/main/res/drawable-xxhdpi/baseline_arrow_back_white_48.png 275 bytes [emitted]
App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png 20.3 KiB [emitted]
App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png 116 KiB [emitted]
App_Resources/Android/src/main/res/drawable-xxhdpi/menu.png 378 bytes [emitted]
App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png 3.87 KiB [emitted]
App_Resources/Android/src/main/res/drawable-xxxhdpi/baseline_add_white_18.png 97 bytes [emitted]
App_Resources/Android/src/main/res/drawable-xxxhdpi/baseline_add_white_24.png 102 bytes [emitted]
App_Resources/Android/src/main/res/drawable-xxxhdpi/baseline_add_white_36.png 113 bytes [emitted]
App_Resources/Android/src/main/res/drawable-xxxhdpi/baseline_add_white_48.png 116 bytes [emitted]
App_Resources/Android/src/main/res/drawable-xxxhdpi/baseline_arrow_back_white_18.png 203 bytes [emitted]
App_Resources/Android/src/main/res/drawable-xxxhdpi/baseline_arrow_back_white_24.png 261 bytes [emitted]
App_Resources/Android/src/main/res/drawable-xxxhdpi/baseline_arrow_back_white_36.png 275 bytes [emitted]
App_Resources/Android/src/main/res/drawable-xxxhdpi/baseline_arrow_back_white_48.png 408 bytes [emitted]
App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png 73.8 KiB [emitted]
App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png 193 KiB [emitted]
App_Resources/Android/src/main/res/drawable-xxxhdpi/menu.png 466 bytes [emitted]
App_Resources/Android/src/main/res/drawable/baseline_add_24.xml 384 bytes [emitted]
App_Resources/Android/src/main/res/drawable/baseline_arrow_back_24.xml 411 bytes [emitted]
App_Resources/Android/src/main/res/values-v21/colors.xml 104 bytes [emitted]
App_Resources/Android/src/main/res/values-v21/styles.xml 1020 bytes [emitted]
App_Resources/Android/src/main/res/values/colors.xml 237 bytes [emitted]
App_Resources/Android/src/main/res/values/styles.xml 1.68 KiB [emitted]
fonts/FontAwesome.ttf 162 KiB [emitted]
assets/login-logo.png 11.8 KiB [emitted]
assets/logo.png 16.3 KiB [emitted]
package.json 82 bytes [emitted]
starter.js 39 bytes [emitted]
tns-java-classes.js 0 bytes [emitted]
[../$$_lazy_route_resource lazy recursive] ../$$_lazy_route_resource lazy namespace object 160 bytes {bundle} [built]
[./app.scss] 21.3 KiB {bundle} [built]
[./app/app-routing.module.ts] 791 bytes {bundle} [built]
[./app/app.component.html] 3.18 KiB {bundle} [built]
[./app/app.component.ts] 4.64 KiB {bundle} [built]
[./app/app.config.ts] 1.89 KiB {bundle} [built]
[./app/app.http-interceptor.ts] 1.4 KiB {bundle} [built]
[./app/app.module.ts] 1.33 KiB {bundle} [built]
[./app/login/login.module.ts] 773 bytes {0} [built]
[./main.ts] 620 bytes {bundle} [built]
[./package.json] 82 bytes {bundle} [optional] [built]
[./services/feedback.service.ts] 552 bytes {bundle} [built]
[./services/login.service.ts] 1.95 KiB {bundle} [built]
[./services/master.service.ts] 1.18 KiB {bundle} [built]
[./services/storage.service.ts] 1.22 KiB {bundle} [built]
+ 472 hidden modules
Webpack compilation complete. Watching for file changes.
Webpack build done!
Executing before-shouldPrepare hook from /Users/rahulgavande/Projects/production/cloint/hooks/before-shouldPrepare/nativescript-dev-webpack.js
Executing before-cleanApp hook from /Users/rahulgavande/Projects/production/cloint/hooks/before-cleanApp/nativescript-dev-webpack.js
Executing before-prepare hook from /Users/rahulgavande/Projects/production/cloint/hooks/before-prepare/nativescript-dev-sass.js
Hook skipped because either bundling or livesync is in progress.
Executing before-prepare hook from /Users/rahulgavande/Projects/production/cloint/hooks/before-prepare/nativescript-dev-typescript.js
Hook skipped because either bundling or livesync is in progress.
Preparing project...
Executing before-prepareJSApp hook from /Users/rahulgavande/Projects/production/cloint/hooks/before-prepareJSApp/nativescript-dev-webpack.js
Gradle clean...
+ setting applicationId
+ applying user-defined configuration from /Users/rahulgavande/Projects/production/cloint/App_Resources/Android/app.gradle
+ adding nativescript runtime package dependency: nativescript-optimized-with-inspector
+ adding aar plugin dependency: /Users/rahulgavande/Projects/production/cloint/node_modules/nativescript-camera/platforms/android/nativescript_camera.aar
+ adding aar plugin dependency: /Users/rahulgavande/Projects/production/cloint/node_modules/nativescript-ui-sidedrawer/platforms/android/TNSSideDrawer-release.aar
+ adding aar plugin dependency: /Users/rahulgavande/Projects/production/cloint/node_modules/nativescript-web-image-cache/platforms/android/nativescript_web_image_cache.aar
+ adding aar plugin dependency: /Users/rahulgavande/Projects/production/cloint/node_modules/nativescript-ui-core/platforms/android/TNSCore-release.aar
+ adding aar plugin dependency: /Users/rahulgavande/Projects/production/cloint/node_modules/tns-core-modules-widgets/platforms/android/widgets-release.aar
Unable to apply changes on device: emulator-5554. Error is: cp: cannot create directory '/Users/rahulgavande/Projects/production/cloint/platforms/android/app/src': No such file or directory.
Executing after-watch hook from /Users/rahulgavande/Projects/production/cloint/hooks/after-watch/nativescript-dev-sass.js
Executing after-watch hook from /Users/rahulgavande/Projects/production/cloint/hooks/after-watch/nativescript-dev-typescript.js
Executing after-watch hook from /Users/rahulgavande/Projects/production/cloint/hooks/after-watch/nativescript-dev-webpack.js
Stopping webpack watch
答案 0 :(得分:0)
遵循升级指南后,我遇到了完全相同的问题:
https://docs.nativescript.org/releases/upgrade-instructions
首次启动(可行)后,设置权限: sudo chmod -R 755平台/ android /
感谢纳伦德拉的提示。
每次您重新启动“ tns run android --build”时必须执行此操作