Eslint behaves differently between local and CI - github

It seems that eslint behaves different in GitHub actions and in local.
On local I don't get any errors a part from ts warning which are fine.
Wheres in the github actions I seems to get more errors related to some rule about file extension. It's like it doesn't find the files... I am pretty new do GitHub actions but I am not sure what is missing from my config.
CI.yml:
name: Continuous Integration
on:
pull_request:
branches: [main]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v2
- name: Setup Node.js
uses: actions/setup-node#v1
with:
node-version: '15.x'
- uses: actions/checkout#v2
- run: git fetch --prune --unshallow
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache#v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install deps
run: yarn
- name: Lint packages
run: yarn lint
Package.json:
{
"main": "index.js",
"scripts": {
...
"lint": "yarn lint:js && yarn lint:css",
...
},
"dependencies": {
...
},
"devDependencies": {
"#babel/core": "~7.9.0",
"#testing-library/jest-native": "^3.4.3",
"#testing-library/react-native": "^7.1.0",
"#types/jest": "^26.0.20",
"#types/react": "^17.0.1",
"#types/react-native": "^0.63.48",
"#types/react-native-fbsdk": "^3.0.0",
"#types/react-native-maps": "^0.24.0",
"#types/react-native-snap-carousel": "^3.8.2",
"#types/react-native-vector-icons": "^6.4.6",
"#types/react-test-renderer": "^17.0.0",
"#types/styled-components": "^5.1.9",
"#types/styled-components-react-native": "^5.1.1",
"#types/uuid": "^8.3.0",
"#types/yup": "^0.29.11",
"#typescript-eslint/eslint-plugin": "^4.20.0",
"#typescript-eslint/parser": "^4.20.0",
"babel-jest": "~25.2.6",
"babel-plugin-styled-components": "^1.12.0",
"eslint": "^7.19.0",
"eslint-config-prettier": "^7.2.0",
"eslint-import-resolver-typescript": "^2.4.0",
"eslint-loader": "^4.0.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.1.5",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-react-native": "^3.10.0",
"eslint-plugin-sort-destructure-keys": "^1.3.5",
"husky": "^5.1.3",
"jest": "~25.2.6",
"lint-staged": "^10.5.4",
"prettier": "^2.2.1",
"react-test-renderer": "~16.13.1",
"stylelint": "^13.9.0",
"stylelint-config-standard": "^20.0.0",
"stylelint-config-styled-components": "^0.1.1",
"stylelint-processor-styled-components": "^1.10.0",
"typescript": "^4.1.3"
},
"jest": {
"preset": "react-native"
},
"private": true
}

Solution
Rename using git mv <old_filepath> <new_filepath>. You could also first create the new file, copy the content and then delete the old file.
You should do this for all the reported files or directories.
Explanation
I had the same problem until I found out that Git did not save the correct casing of files and directories.
Because Windows and macOS use file systems that are case insensitive, renaming files and directories by just changing the casing, like from Test.js to test.js or from src/Api to src/api, does not change anything for Git.
You can see with git ls-files that there casing did not change from Git's perspective.
When you then go over to GitHub Actions that runs Ubuntu and therefore uses a case sensitive file system, the files can obviously not be found.

Related

Installing React Native Firebase fails at compiling RingBuffer.swift

I am attempting to implement RNFB to my react-native project. for iOS the pods install just fine. However, when I run npm run iOS I get the following error and crash report:
❌ /Users/[Redacted]/Documents/GitHub/[Redacted]/ios/Pods/FirebaseCoreInternal/FirebaseCore/Internal/Sources/HeartbeatLogging/RingBuffer.swift:19:35: reference to generic type 'Array' requires arguments in <...>
case outOfBoundsPush(pushIndex: Array.Index, endIndex: Array.Index)
I was able to find this article that was very recent and it appears to be what I'm looking for but I have absolutely no idea what it says... google translate helps a little bit but I do not know enough to be able to infer a solution.
honestly I do not really even need anything related to heartbeat from firebase. I just need to use the Firebase Analytics and Google Analytics capabilities. But this package came with it and I don't see a way to tell it not to compile.
Regardless, I attempted to downgrade to a lower version of RNFB, I believe I it was version 15.4.0 -> 15.0.0 to see if maybe the new package was the problem but I still get the same errors.
I tried modifying the RingBuffer.swift file... but the file is read-only.
This issue is happening in other FirebaseCore/Internal files...
The following build commands failed:
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
CompileSwift normal x86_64 /Users/[Redacted]/Documents/GitHub/[Redacted]/ios/Pods/FirebaseCoreInternal/[Redacted]/Internal/Sources/HeartbeatLogging/HeartbeatController.swift
CompileSwift normal x86_64 /Users/[Redacted]/Documents/GitHub/[Redacted]/ios/Pods/FirebaseCoreInternal/FirebaseCore/Internal/Sources/HeartbeatLogging/HeartbeatsBundle.swift
CompileSwift normal x86_64 /Users/[Redacted]/Documents/GitHub/[Redacted]/ios/Pods/FirebaseCoreInternal/FirebaseCore/Internal/Sources/HeartbeatLogging/HeartbeatsPayload.swift
CompileSwift normal x86_64 /Users/[Redacted]/Documents/GitHub/[Redacted]/ios/Pods/FirebaseCoreInternal/FirebaseCore/Internal/Sources/HeartbeatLogging/RingBuffer.swift
here is my package.json file
"main": "index.js",
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"web": "expo start --web",
"start": "react-native start",
"test": "jest",
"debug-build-android": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res",
"build-android": "./android/gradlew ./android/assembleRelease"
},
"dependencies": {
"#react-native-async-storage/async-storage": "^1.13.4",
"#react-native-community/masked-view": "0.1.10",
"#react-native-community/netinfo": "^5.9.9",
"#react-native-firebase/app": "^15.0.0",
"#react-navigation/bottom-tabs": "^5.11.2",
"#react-navigation/drawer": "^5.11.4",
"#react-navigation/native": "^5.8.10",
"#react-navigation/stack": "^5.12.8",
"axios": "^0.21.1",
"expo": "~40.0.0",
"expo-app-loading": "1.0.3",
"expo-asset": "~8.2.1",
"expo-blur": "~8.2.2",
"expo-file-system": "~9.3.0",
"expo-gl": "^9.2.0",
"expo-keep-awake": "~8.4.0",
"expo-screen-orientation": "^3.3.0",
"expo-splash-screen": "~0.8.1",
"expo-three": "^5.5.1",
"expo-updates": "~0.4.0",
"expo-web-browser": "~8.6.0",
"immutability-helper": "^3.1.1",
"lodash.throttle": "^4.1.1",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "~0.63.4",
"react-native-background-downloader": "^2.3.4",
"react-native-base64": "^0.2.1",
"react-native-elements": "3.4.1",
"react-native-fast-image": "^8.3.4",
"react-native-gesture-handler": "~1.8.0",
"react-native-maps": "^0.27.1",
"react-native-reanimated": "~1.13.0",
"react-native-render-html": "^5.0.1",
"react-native-safe-area-context": "^3.1.9",
"react-native-screens": "~2.15.0",
"react-native-toast-message": "1.4.9",
"react-native-unimodules": "~0.12.0",
"react-native-video": "^5.2.0",
"react-native-view-pdf": "^0.13.2",
"react-native-webview": "11.0.0",
"react-native-zip-archive": "^6.0.2",
"react-navigation-header-buttons": "^7.0.1",
"react-redux": "^7.2.2",
"react-three-fiber": "^5.3.21",
"realm": "^10.4.0",
"redux": "^4.0.5",
"redux-devtools-extension": "^2.13.9",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.3.0",
"three": "0.123.0"
},
"devDependencies": {
"#babel/core": "~7.9.0",
"#testing-library/react-native": "^7.2.0",
"#types/jest": "^26.0.19",
"#types/lodash.throttle": "^4.1.6",
"#types/react": "^17.0.0",
"#types/react-native": "^0.63.40",
"#types/react-native-background-downloader": "^2.3.3",
"#types/react-native-base64": "^0.2.0",
"#types/react-native-video": "^5.0.10",
"#types/react-redux": "^7.1.14",
"#types/react-test-renderer": "^17.0.0",
"#types/redux-mock-store": "^1.0.3",
"#types/three": "^0.125.3",
"babel-jest": "^25.2.6",
"jest": "~25.2.6",
"jest-expo": "^42.1.0",
"react-test-renderer": "~16.13.1",
"redux-mock-store": "^1.5.4",
"ts-node": "^10.2.1",
"typescript": "^4.1.3"
},
"jest": {
"preset": "jest-expo"
},
"private": true,
"version": "1.0.1"
}
here is my pod file
$RNFirebaseAsStaticFramework = true #firebase requires static frameworkds
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
platform :ios, '11.0'
target '[Redacted]' do
use_unimodules!
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
# react native firebase requires frameworks...
use_frameworks!
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
# use_flipper!({ 'Flipper-Folly' => '2.5.3', 'Flipper' => '0.87.0', 'Flipper-RSocket' => '1.3.1' })
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
config.build_settings['SWIFT_VERSION'] = '5.0'
end
end
flipper_post_install(installer)
end
end
Xcode Version : Version 13.4.1 (13F100)
some lines have been removed for anonymity.
I was able to fix this compilation error by overwriting the specified pod dependency .swift file with modifications to the following code block
//dependency errors at this point in the file
case outOfBoundsPush(pushIndex: Array.Index, endIndex: Array.Index)
//adding a type definition for the array fixes compilation error
case outOfBoundsPush(pushIndex: Array<Any>.Index, endIndex: Array<Any>.Index)
now if only I knew where to report the pod file discrepancy. Or if anyone would like to tell me why the pod file is packaged improperly for my compiler to understand?
Firebase's minimum supported Swift Version is 5.3 - so the override in the Podfile's post_install script may be the issue. Try deleting or updating config.build_settings['SWIFT_VERSION'] = '5.0'

Code coverage don't generate report on azure pipeline

my objective:
is to successfully publish my coverage report in a pipeline on azure devops.
To send it to SonarCloud
my successes
locally on my pc
I manage to generate the coverage report in html format and also in xml
1. script task on my pipeline:
- script: |
npx ng test --code-coverage --karma-config src/karma-ci.conf.js
condition: succeededOrFailed()
displayName: Generate unit tests report
2. kama-ci.config.js file:
module.exports = function (config) {
config.set({
frameworks: ['jasmine', '#angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-junit-reporter'),
require('karma-coverage'),
require('karma-coverage-istanbul-reporter'),
require('#angular-devkit/build-angular/plugins/karma')
],
junitReporter: {
outputDir: 'TestResults/junit',
outputFile: 'unittest-results.xml',
useBrowserName: false
},
coverageReporter: {
type : 'cobertura',
dir : 'TestResults',
subdir: 'coverage',
file: 'code-coverage.xml'
},
reporters: ['progress', 'junit', 'coverage'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: false,
customLaunchers: {
ChromeHeadless: {
base: 'Chrome',
flags: [
'--headless',
'--disable-gpu',
'--no-sandbox',
'--remote-debugging-port=9222',
]
}
},
browsers: ['ChromeHeadless'],
singleRun: true
});
};
3. Result error:
But the problem is, report generation always starts and fails in the pipeline.
Here is his result, despite the fact that I give it the condition of always succeeding.
2021-06-02T14:50:42.8314347Z ##[section]Starting: Generate unit tests
2021-06-02T14:50:42.8319061Z ==============================================================================
2021-06-02T14:50:42.8319314Z Task : Command line
2021-06-02T14:50:42.8319582Z Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
2021-06-02T14:50:42.8319857Z Version : 2.182.0
2021-06-02T14:50:42.8320038Z Author : Microsoft Corporation
2021-06-02T14:50:42.8320318Z Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
2021-06-02T14:50:42.8320658Z ==============================================================================
2021-06-02T14:50:42.9528480Z Generating script.
2021-06-02T14:50:42.9529859Z Script contents:
2021-06-02T14:50:42.9530447Z npx ng test --code-coverage --karma-config src/karma-ci.conf.js
2021-06-02T14:50:42.9530922Z ========================== Starting Command Output ===========================
2021-06-02T14:50:42.9558445Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/7177135e-e9ad-4ecf-b6f1-86193e021ca3.sh
2021-06-02T14:51:01.5747869Z [32m02 06 2021 14:51:01.570:INFO [karma-server]: [39mKarma v3.1.4 server started at http://0.0.0.0:9876/
2021-06-02T14:51:01.5749272Z [32m02 06 2021 14:51:01.573:INFO [launcher]: [39mLaunching browsers ChromeHeadless with concurrency unlimited
2021-06-02T14:51:01.5774208Z [32m02 06 2021 14:51:01.577:INFO [launcher]: [39mStarting browser Chrome
2021-06-02T14:51:03.4612458Z
2021-06-02T14:51:03.4614556Z ERROR in [96mapp/services/dealflow-secondary.service.ts[0m:[93m4[0m:[93m37[0m - [91merror[0m[90m TS2307: [0mCannot find module '../entities/ISecondaryPortfolio'.
2021-06-02T14:51:03.4615270Z
2021-06-02T14:51:03.4616058Z [7m4[0m import { ISecondaryPortfolio } from '../entities/ISecondaryPortfolio';
2021-06-02T14:51:03.4616981Z [7m [0m [91m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[0m
2021-06-02T14:51:03.4618161Z [96mapp/shared/api/geography.api.ts[0m:[93m8[0m:[93m27[0m - [91merror[0m[90m TS2307: [0mCannot find module 'src/app/ui/funds/fund-list/models/Geography'.
2021-06-02T14:51:03.4618794Z
2021-06-02T14:51:03.4619553Z [7m8[0m import { Geography } from 'src/app/ui/funds/fund-list/models/Geography';
2021-06-02T14:51:03.4620454Z [7m [0m [91m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[0m
2021-06-02T14:51:03.4621635Z [96mapp/shared/services/geography.service.ts[0m:[93m2[0m:[93m27[0m - [91merror[0m[90m TS2307: [0mCannot find module 'src/app/ui/funds/fund-list/models/Geography'.
2021-06-02T14:51:03.4622232Z
2021-06-02T14:51:03.4622986Z [7m2[0m import { Geography } from 'src/app/ui/funds/fund-list/models/Geography';
2021-06-02T14:51:03.4623886Z [7m [0m [91m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[0m
2021-06-02T14:51:03.4625110Z [96mapp/ui/dealflow/add-fund-portfolio/add-fund-portfolio.component.ts[0m:[93m7[0m:[93m37[0m - [91merror[0m[90m TS2307: [0mCannot find module 'src/app/entities/ISecondaryPortfolio'.
2021-06-02T14:51:03.4625760Z
2021-06-02T14:51:03.4626506Z [7m7[0m import { ISecondaryPortfolio } from 'src/app/entities/ISecondaryPortfolio';
2021-06-02T14:51:03.4627440Z [7m [0m [91m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[0m
2021-06-02T14:51:03.4628643Z [96mapp/ui/dealflow/dealflow.service.ts[0m:[93m13[0m:[93m37[0m - [91merror[0m[90m TS2307: [0mCannot find module '../../entities/ISecondaryPortfolio'.
2021-06-02T14:51:03.4629250Z
2021-06-02T14:51:03.4629996Z [7m13[0m import { ISecondaryPortfolio } from '../../entities/ISecondaryPortfolio';
2021-06-02T14:51:03.4630925Z [7m [0m [91m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[0m
2021-06-02T14:51:03.4632053Z [96mapp/ui/dealflow/models/DealFlow.ts[0m:[93m1[0m:[93m37[0m - [91merror[0m[90m TS2307: [0mCannot find module 'src/app/entities/ISecondaryPortfolio'.
2021-06-02T14:51:03.4632630Z
2021-06-02T14:51:03.4633391Z [7m1[0m import { ISecondaryPortfolio } from "src/app/entities/ISecondaryPortfolio";
2021-06-02T14:51:03.4634782Z [7m [0m [91m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[0m
2021-06-02T14:51:03.4636019Z [96mapp/ui/dealflow/project-secondary/project-secondary.component.ts[0m:[93m15[0m:[93m37[0m - [91merror[0m[90m TS2307: [0mCannot find module '../../../entities/ISecondaryPortfolio'.
2021-06-02T14:51:03.4638214Z
2021-06-02T14:51:03.4640037Z [7m15[0m import { ISecondaryPortfolio } from '../../../entities/ISecondaryPortfolio';
2021-06-02T14:51:03.4641024Z [7m [0m [91m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[0m
2021-06-02T14:51:03.4642193Z [96mapp/ui/dealflow/send-to-mdm-popup/send-to-mdm-popup.component.ts[0m:[93m5[0m:[93m30[0m - [91merror[0m[90m TS2307: [0mCannot find module 'src/app/entities/IMDMResponse'.
2021-06-02T14:51:03.4642778Z
2021-06-02T14:51:03.4643427Z [7m5[0m import { IMDMResponse } from 'src/app/entities/IMDMResponse';
2021-06-02T14:51:03.4644246Z [7m [0m [91m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[0m
2021-06-02T14:51:03.4645318Z [96mapp/ui/dealflow/tests-dealflow/dealflow.spec.ts[0m:[93m1[0m:[93m37[0m - [91merror[0m[90m TS2307: [0mCannot find module '../../../entities/ISecondaryPortfolio'.
2021-06-02T14:51:03.4645885Z
2021-06-02T14:51:03.4646561Z [7m1[0m import { ISecondaryPortfolio } from '../../../entities/ISecondaryPortfolio';
2021-06-02T14:51:03.4647398Z [7m [0m [91m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[0m
2021-06-02T14:51:03.4648510Z [96mapp/ui/funds/fund-list/create-fund/create-fund.component.spec.ts[0m:[93m2[0m:[93m27[0m - [91merror[0m[90m TS2307: [0mCannot find module '../models/Geography'.
2021-06-02T14:51:03.4649050Z
2021-06-02T14:51:03.4649676Z [7m2[0m import { Geography } from '../models/Geography';
2021-06-02T14:51:03.4650403Z [7m [0m [91m ~~~~~~~~~~~~~~~~~~~~~[0m
2021-06-02T14:51:03.4651471Z [96mapp/ui/funds/fund-list/create-fund/create-fund.component.ts[0m:[93m15[0m:[93m27[0m - [91merror[0m[90m TS2307: [0mCannot find module '../models/Geography'.
2021-06-02T14:51:03.4652001Z
2021-06-02T14:51:03.4652603Z [7m15[0m import { Geography } from '../models/Geography';
2021-06-02T14:51:03.4653352Z [7m [0m [91m ~~~~~~~~~~~~~~~~~~~~~[0m
2021-06-02T14:51:03.4653685Z
2021-06-02T14:51:03.5172693Z ##[error]Bash exited with code '1'.
2021-06-02T14:51:03.5208748Z ##[section]Finishing: Generate unit tests
You should add "reporters" inside "coverageReporter" in your karma.config, like so:
coverageReporter: {
type : 'cobertura',
dir : 'TestResults',
subdir: 'coverage',
file: 'code-coverage.xml',
reporters: [ { type: 'cobertura' } ]
},
1. My project is:
Front end project with Node.Js and npm package
Angular CLI: 8.3.23
Node: 12.18.3
OS: win32 x64
Angular: 8.2.14
1. i show you my pipeline
trigger:
tags:
include:
- v*
variables:
- name: ARTIFACTS_FEED_NAME
value: MyFeed
stages:
- stage: Build
jobs:
- job: Build
steps:
- task: NodeTool#0
inputs:
versionSpec: 10.15.x
displayName: Install and use 10.x Node.js version
- task: Npm#1
inputs:
command: install
customRegistry: useFeed
customFeed: $(ARTIFACTS_FEED_NAME)
displayName: Packages restore
- script: |
ls
displayName: Check source output
- script: |
npx ng test --code-coverage --karma-config src/karma-ci.conf.js
condition: succeededOrFailed()
displayName: Generate unit tests report
- script: |
ls src
displayName: Check unit tests output
- task: PublishTestResults#2
condition: succeededOrFailed()
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '**/TestResults/junit/unittest-results.xml'
displayName: Publish unit test results
- task: PublishCodeCoverageResults#1
displayName: Publish code coverage report
condition: succeededOrFailed()
inputs:
codeCoverageTool: Cobertura
# summaryFileLocation: '$(Build.SourcesDirectory)/coverage/**/TestResults/code-coverage.xml'
summaryFileLocation: '**/src/TestResults/coverage/code-coverage.xml'
failIfCoverageEmpty: true

error building `ionic-angular` app with `capacitor`

I'm trying to follow this tutorial: https://www.joshmorony.com/using-google-maps-and-geolocation-in-ionic-with-capacitor/
If I use the following steps to create the project
ionic start gmap3 blank --type=ionic-angular --no-link && cd ./gmap3
npm install #types/googlemaps --save-dev
ionic generate component GoogleMaps
npm run build # OK
# install capacitor
npm install --save #capacitor/cli #capacitor/core
# npm uninstall --save cordova-plugin-splashscreen
npx cap init gmap com.example.gmap
npm run build # ERROR after adding #capacitor/core
I get the following error AFTER I add capacitor the the project:
[11:19:12] transpile started ...
[11:19:16] typescript: node_modules/#types/node/index.d.ts, line: 194
Subsequent variable declarations must have the same type. Variable 'process' must be of type '{ env: { [key:
string]: string; }; }', but here has type 'Process'.
L193: interface RequireResolve {
L194: (id: string, options?: { paths?: string[]; }): string;
L195: paths(request: string): string[] | null;
[11:19:16] ionic-app-script task: "build"
[11:19:16] Error: Failed to transpile program
Error: Failed to transpile program
at new BuildError (/dev/ionic3/gmap3/node_modules/#ionic/app-scripts/dist/util/errors.js:16:28)
at /dev/ionic3/gmap3/node_modules/#ionic/app-scripts/dist/transpile.js:159:20
at new Promise (<anonymous>)
at transpileWorker (/dev/ionic3/gmap3/node_modules/#ionic/app-scripts/dist/transpile.js:107:12)
at Object.transpile (/dev/ionic3/gmap3/node_modules/#ionic/app-scripts/dist/transpile.js:64:12)
at /dev/ionic3/gmap3/node_modules/#ionic/app-scripts/dist/build.js:109:82
at <anonymous>
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! gmap3#0.0.1 build: `ionic-app-scripts build`
npm ERR! Exit status 1
But I can clone a github repo (modified with the same package.json) and it builds fine. see: https://github.com/mixuala/ionic3-gmaps.git
git clone https://github.com/mixuala/ionic3-gmaps.git gmap3.2
cd gmap3.2
npm install
npm run build
why is that???
Here is the package.json:
"dependencies": {
"#angular/animations": "5.2.11",
"#angular/common": "5.2.11",
"#angular/compiler": "5.2.11",
"#angular/compiler-cli": "5.2.11",
"#angular/core": "5.2.11",
"#angular/forms": "5.2.11",
"#angular/http": "5.2.11",
"#angular/platform-browser": "5.2.11",
"#angular/platform-browser-dynamic": "5.2.11",
"#capacitor/cli": "^1.0.0-beta.7",
"#capacitor/core": "^1.0.0-beta.7",
"#ionic-native/core": "~4.12.0",
"#ionic-native/splash-screen": "~4.12.0",
"#ionic-native/status-bar": "~4.12.0",
"#ionic/storage": "2.1.3",
"ionic-angular": "3.9.2",
"ionicons": "3.0.0",
"rxjs": "5.5.11",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.26"
},
"devDependencies": {
"#ionic/app-scripts": "^3.2.0",
"#types/googlemaps": "^3.30.12",
"typescript": "~2.6.2"
},
This is a known issue in the #ionic/cli repo. Please see #3541.
It can be solved adding "types": [] to the "compilerOptions" parameter of the file tsconfig.json.

Error: Couldn't find preset "latest" relative to directory "/app"

Receiving an error within my Deis app; with the introduction of Helmet to the frontend middleware. The app is initially based on React Boilerplate and most of the suggestions I've run by, I've already implemented/explored within the source and am still producing this "phantom" error.
This only occurs on the Deis app instance; when reproducing the steps locally, there's zero issues with it completing the (production) build process.
Sure, I could remove helmet from the middleware, but, I'd rather not...
Error Output:
> pkg-name#0.0.1 start /app
> npm run start:production
> pkg-name#0.0.1 start:production /app
> npm run build && npm run start:prod
> pkg-name#0.0.1 build /app
> cross-env NODE_ENV=production webpack --config internals/webpack/webpack.prod.babel.js --color -p --progress
/app/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:328
throw e;
^
2017-10-27T15:50:48+00:00 deis-app-name[]:
Error: Couldn't find preset "latest" relative to directory "/app"
at /app/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:293:19
at Array.map (<anonymous>)
at OptionManager.resolvePresets (/app/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
at OptionManager.mergePresets (/app/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10)
at OptionManager.mergeOptions (/app/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14)
at OptionManager.init (/app/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
at compile (/app/node_modules/babel-register/lib/node.js:103:45)
at loader (/app/node_modules/babel-register/lib/node.js:144:14)
at Object.require.extensions.(anonymous function) [as .js] (/app/node_modules/babel-register/lib/node.js:154:7)
at Module.load (module.js:531:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! pkg-name#0.0.1 build: `cross-env NODE_ENV=production webpack --config internals/webpack/webpack.prod.babel.js --color -p --progress`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pkg-name#0.0.1 build script.
Dependency object value/pair:
"dependencies": {
"babel-cli": "6.18.0",
"babel-core": "6.21.0",
"babel-eslint": "7.1.1",
"babel-loader": "6.2.10",
"babel-plugin-dynamic-import-node": "1.0.0",
"babel-plugin-react-intl": "2.2.0",
"babel-plugin-react-transform": "2.0.2",
"babel-plugin-transform-es2015-modules-commonjs": "6.18.0",
"babel-plugin-transform-react-constant-elements": "6.9.1",
"babel-plugin-transform-react-inline-elements": "6.8.0",
"babel-plugin-transform-react-remove-prop-types": "0.2.11",
"babel-preset-latest": "6.16.0",
"babel-preset-react": "6.16.0",
"babel-preset-react-hmre": "1.1.1",
"babel-preset-stage-0": "6.16.0",
"babel-polyfill": "6.20.0",
"basic-auth": "^2.0.0",
"bootstrap": "4.0.0-beta",
"chalk": "^1.1.3",
"cheerio": "0.22.0",
"circular-dependency-plugin": "2.0.0",
"classnames": "^2.2.5",
"compression": "1.6.2",
"cross-env": "3.1.3",
"css-loader": "0.26.1",
"dotenv": "^4.0.0",
"dotenv-safe": "^4.0.4",
"dotenv-webpack": "^1.5.4",
"eslint-import-resolver-webpack": "0.8.0",
"exports-loader": "0.6.3",
"express": "4.14.0",
"express-basic-auth": "^1.1.2",
"file-loader": "0.9.0",
"fontfaceobserver": "^2.0.13",
"helmet": "^3.9.0",
"html-loader": "0.4.4",
"html-webpack-plugin": "2.24.1",
"image-webpack-loader": "2.0.0",
"immutable": "3.8.1",
"imports-loader": "0.6.5",
"intl": "1.2.5",
"invariant": "2.2.2",
"ip": "1.1.4",
"lodash": "4.17.2",
"minimist": "1.2.0",
"moment": "2.18.0",
"ngrok": "2.2.4",
"nsp": "^2.8.1",
"offline-plugin": "4.5.2",
"query-string": "^5.0.1",
"react": "15.4.1",
"react-addons-test-utils": "15.4.1",
"react-dom": "15.4.1",
"react-helmet": "3.2.2",
"react-intl": "2.1.5",
"react-paginate": "^4.4.4",
"react-redux": "4.4.6",
"react-router": "3.0.0",
"react-router-redux": "4.0.6",
"react-router-scroll": "0.4.1",
"react-scroll": "^1.5.5",
"react-widgets": "^4.0.2",
"react-widgets-moment": "^4.0.2",
"reactstrap": "^5.0.0-alpha.3",
"redux": "3.6.0",
"redux-form": "^7.0.4",
"redux-immutable": "3.0.8",
"redux-saga": "0.14.0",
"redux-saga-routines": "^2.0.2",
"reselect": "2.5.4",
"rimraf": "2.5.4",
"sanitize.css": "4.1.0",
"snyk": "^1.45.0",
"style-loader": "0.13.1",
"styled-components": "1.1.2",
"svg-sprite-loader": "^3.4.0",
"url-loader": "0.5.7",
"warning": "3.0.0",
"webpack": "2.2.0-rc.3",
"webpack-dev-middleware": "1.9.0",
"webpack-hot-middleware": "2.15.0",
"whatwg-fetch": "2.0.1"
},
"devDependencies": {
"coveralls": "2.11.15",
"enzyme": "2.6.0",
"eslint": "3.11.1",
"eslint-config-airbnb": "13.0.0",
"eslint-config-airbnb-base": "10.0.1",
"eslint-plugin-import": "2.2.0",
"eslint-plugin-jsx-a11y": "2.2.3",
"eslint-plugin-react": "6.7.1",
"eslint-plugin-redux-saga": "0.1.5",
"eventsource-polyfill": "0.9.6",
"jest-cli": "18.0.0",
"lint-staged": "3.2.1",
"node-plop": "0.5.4",
"node-sass": "^4.5.3",
"null-loader": "0.1.1",
"plop": "1.7.3",
"pre-commit": "1.1.3",
"sass-loader": "^6.0.6",
"shelljs": "^0.7.5",
"sinon": "2.0.0-pre"
}
Runtime configuration:
webpack: 2.2.0-rc.3
babel core: 6.26.0
babel loader: 6.18.0
helmet: 3.9.0
Environment workflow:
Running on a Deis instance (kube & docker)
Environment variables:
NODE_ENV production
NODE_MODULES_CACHE false
NPM_CONFIG_PRODUCTION true
Additional resources:
https://github.com/babel/babel/issues/6558
https://github.com/babel/babel-loader#usage
https://github.com/react-boilerplate/react-boilerplate/pull/1236#issuecomment-305821664
BabelJs over Heroku: Couldn't find preset "env" relative to directory "/app"
https://devcenter.heroku.com/articles/nodejs-support#devdependencies
What I do - in development (on your local machine), I just install all the latest babel deps in a grandparent directory. Node.js will walk up the filesystem looking for its dependencies (node_modules). This way you don't have to install Babel for each project. This technique doesn't even need NODE_PATH or npm link, it just works like this:
$HOME/
projects/
node_modules/ # install all babel deps here
project-a/
project-b/
project-c/
or, even simpler, you can just install babel deps in $HOME/node_modules, and that will work too. Just an idea. This is just the way Node.js works - it walks up the filesystem all the way to $HOME, looking for node_modules/x, if it can't find it in $HOME/node_modules/x, then it fails.
I removed "latest" from presest array and the "prestes" equals ["react","stage-0"]

Unable to get arrow function to work

I am trying to upgrade to es6 for an existing project with Babel. My package.json contains the babel plugins:
"devDependencies": {
"babel-cli": "^6.8.0",
"babel-core": "^6.0.0",
"babel-eslint": "^6.0.4",
"babel-loader": "^6.2.4",
"babel-plugin-transform-runtime": "^6.8.0",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-1": "^6.5.0",
"babel-preset-stage-2": "^6.5.0",
"babel-register": "^6.8.0",
"copy-webpack-plugin": "^2.1.3",
"css-loader": "^0.23.1",
"eslint": "^2.9.0",
"material-ui": "^0.15.0",
"node-sass": "^3.5.3",
"react-hot-loader": "^1.3.0",
"sass-loader": "^3.2.0",
"style-loader": "^0.13.1",
"webpack": "^1.13.0",
"webpack-dev-server": "^1.12.1"
My .babelrc file the following:
{
"presets": ["es2015", "stage-1", "react"],
"plugins": [
"transform-es2015-arrow-functions",
"transform-class-properties"
]
}
And my webpack file contains the following:
```
module: {
loaders: [{
test: /\.js$/,
exclude: /node_modules/,
loaders: ['react-hot', 'babel-loader?presets[]=react,presets[]=es2015,presets[]=stage-2']
},
{
test: /\.scss$/,
loaders: ["style", "css", "sass"]
}
]}
```
And I run my node app with the following command:
cp views/index.html public/index.html && NODE_ENV=development webpack && npm run webpack-dev-server"
I am using a toggle function with material-ui in order to get Drawer component triggered by a hamburger menu in the Appbar component.
The Toggle functions are as follows (as per documentation)
```
handleToggle = () => this.setState({open: !this.state.open});
handleClose = () => this.setState({open: false});
``
However, whenever I run this I get the following error:
Unexpected token (29:16)
27 |
28 |
> 29 | handleToggle () => this.setState({open: !this.state.open});
| ^
30 |
If I change the function from arrow to a more old-school approach I can get it to work i.e.
handleToggle() {
this.setState({open: !this.state.open});
alert("handleToggle clicked");
}
However, I do not want to have to customise every component in material-ui in order to enable it to be backwards compatible. How do I upgrade my code without getting errors?