Node App builds locally but fails in GitlabCI - node.js

I have a svelte app that is built with SvelteKit. It runs fine locally and local Docker image, but it fails in the Gitlab CI.
This is my gitlab-ci.yml:
image: node:16.15.0-alpine
stages:
- build
- lint
- test
install:
stage: build
script:
- cd frontend/
- npm ci
artifacts:
paths:
- frontend/
only:
- merge_requests
format-and-lint:
stage: lint
needs: [install]
script:
- cd frontend/
- npm run format
- npm run lint
artifacts:
paths:
- frontend/
only:
- merge_requests
# --------------- This step always fails ---------------
cypress:
stage: test
needs: [format-and-lint]
script:
- cd frontend/
- npm run build
- npm run preview
- npx cypress run --spec "cypress/integration/lehrenden-eintragung/*"
artifacts:
paths:
- frontend/
only:
- merge_requests
# -----------------------------------------------------
vitest:
stage: test
needs: [format-and-lint]
script:
- cd frontend/
- npm run test
artifacts:
paths:
- frontend/
only:
- merge_requests
My package.json looks like this:
{
"bezeichnungLang": "llp-frontend",
"version": "1.0.0",
"type": "module",
"scripts": {
"dev": "svelte-kit dev",
"build": "svelte-kit build",
"package": "svelte-kit package",
"preview": "svelte-kit preview",
"prepare": "svelte-kit sync",
"check": "svelte-check --tsconfig ./tsconfig.json --compiler-warnings \"css-unused-selector:ignore\"",
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
"format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. .",
"test": "vitest run",
"coverage": "vitest run --coverage"
},
"devDependencies": {
"#sveltejs/adapter-auto": "^1.0.0-next.40",
"#sveltejs/kit": "^1.0.0-next.323",
"#testing-library/jest-dom": "^5.16",
"#testing-library/svelte": "^3.1",
"#testing-library/user-event": "^14.0",
"#tsconfig/svelte": "^3.0",
"#types/bootstrap": "^5.1.9",
"#types/jest": "^27.4",
"#types/testing-library__jest-dom": "^5.14",
"#typescript-eslint/eslint-plugin": "^5.18",
"#typescript-eslint/parser": "^5.18",
"bootstrap": "^5.1",
"cypress": "^9.6.1",
"eslint": "^8.14",
"eslint-config-prettier": "^8.5",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-svelte3": "^3.4",
"jsdom": "^19.0",
"popper.js": "^1.16",
"prettier": "^2.6",
"prettier-plugin-svelte": "^2.7",
"purgecss-from-svelte": "^2.0",
"simple-svelte-autocomplete": "^2.4.0",
"source-map-support": "^0.5",
"svelte": "^3.46",
"svelte-check": "^2.4",
"svelte-preprocess": "^4.10",
"ts-node": "^10.7",
"ts-replace-all": "^1.0",
"tslib": "^2.3",
"typescript": "^4.6.4",
"vitest": "^0.10",
"vitest-svelte-kit": "^0.0"
},
"babel": {
"plugins": [
"#babel/plugin-proposal-class-properties"
],
"presets": [
[
"#babel/preset-env"
]
]
},
"browserslist": [
"since 2017-06"
],
"dependencies": {
"sass": "^1.52.2",
"vite": "^2.9.9"
}
}
The GitlabCI fails with the following error:
Using docker image sha256:e5065cc780745864eeee3280fe347b33e90961c98c7d3e14d5b660e16aef24ce for node:16.15.0-alpine with digest node#sha256:1a9a71ea86aad332aa7740316d4111ee1bd4e890df47d3b5eff3e5bded3b3d10 ...
$ cd frontend/
$ ls
convertTestData.js
cypress
cypress.json
node_modules
package-lock.json
package.json
setupTestEnvironment.ts
src
static
svelte.config.js
tsconfig.json
vite.config.ts
vitest.config.js
$ npm run build
> build
> svelte-kit build
8:59:30 PM [vite-plugin-svelte] hmr is enabled but compilerOptions.dev is false, forcing it to true
8:59:30 PM [vite-plugin-svelte] options.hot is enabled but does not work on production build, forcing it to false
8:59:30 PM [vite-plugin-svelte] you are building for production but compilerOptions.dev is true, forcing it to false
vite v2.9.12 building for production...
transforming...
✓ 1 modules transformed.
[vite-plugin-svelte] /builds/llp/llp/frontend/src/routes/__layout.svelte:32:1 The keyword 'let' is reserved
file: /builds/llp/llp/frontend/src/routes/__layout.svelte:32:1
30 |
31 | function create_fragment(ctx) {
32 | let div3;
^
33 | let div2;
34 | let div0;
> /builds/llp/llp/frontend/src/routes/__layout.svelte:32:1 The keyword 'let' is reserved
at error (file:///builds/llp/llp/frontend/node_modules/svelte/compiler.mjs:17716:19)
at Parser$1.error (file:///builds/llp/llp/frontend/node_modules/svelte/compiler.mjs:17792:9)
at Parser$1.acorn_error (file:///builds/llp/llp/frontend/node_modules/svelte/compiler.mjs:17786:14)
at read_expression (file:///builds/llp/llp/frontend/node_modules/svelte/compiler.mjs:8652:16)
at mustache (file:///builds/llp/llp/frontend/node_modules/svelte/compiler.mjs:17475:28)
at new Parser$1 (file:///builds/llp/llp/frontend/node_modules/svelte/compiler.mjs:17751:21)
at parse$3 (file:///builds/llp/llp/frontend/node_modules/svelte/compiler.mjs:17883:20)
at compile (file:///builds/llp/llp/frontend/node_modules/svelte/compiler.mjs:32265:17)
at compileSvelte2 (file:///builds/llp/llp/frontend/node_modules/#sveltejs/vite-plugin-svelte/dist/index.js:351:20)
at async Object.transform (file:///builds/llp/llp/frontend/node_modules/#sveltejs/vite-plugin-svelte/dist/index.js:1791:25)
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1
All other steps in the pipeline run fine and finish without error. Please help!

This error is mainly from [vite-plugin-svelte] which couldn't transform line 32 at __layout.svelte component.
function create_fragment(ctx) {
let div3;
^
let div2;
let div0;
/builds/llp/llp/frontend/src/routes/__layout.svelte:32:1 The keyword 'let' is reserved
Try upgrade the following dependencies:
#sveltejs/kit (this has vite built-in, and doesn't need extra dependency)
svelte and related dependencies.

The solution was to specify an exact version of sveltejs/kit. The build fails on version 1.0.0-next.350 but runs fine with 1.0.0-next.323. Somehow, besides having the same node version, in the pipeline version 1.0.0-next.350 was installed.

Related

How do I pass parameters to the husky or git pre-push hook?

I have a project in node. In this project I want to standardize commits and versioning. I installed husky, commitzen, commitlint and standard-version.
They work great, my commit is running git-cz and I'm able to standardize my commits. So far so good! But every time I need to run the command "yarn standard-release" and "git push --follow-tags origin branch_whatever", and this is not productive for me.
What I want is, every time I do a "git push" command after a commit (fix, feat or chore), I want to run the standard-release add the options "--follow-tags origin branch_whatever" and then yes run the "git push" command, but if I put this command inside the pre-push hook, it loops on the husky, I've already tried using --no-verify, HUSKY=0 and it doesn't work.
Inside the pre-push hook script I can run the standard-release and "git push --follow-tags origin branch_whatever" without looping, any suggestions to solve this?
Note: Running this on CI/CD is not feasible for me at the moment.
Thanks!
package.json
{
"name": "app",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js",
"prepare": "husky install",
"release": "standard-version",
"commit": "git-cz"
},
"keywords": [],
"license": "ISC",
"dependencies": {
"express": "^4.18.1"
},
"devDependencies": {
"#commitlint/cli": "^17.0.3",
"#commitlint/config-conventional": "^17.0.3",
"commitizen": "^4.2.5",
"cz-conventional-changelog": "3.3.0",
"husky": "^8.0.1",
"standard-version": "^9.5.0"
},
"commitlint": {
"extends": [
"#commitlint/config-conventional"
],
"rules": {
"subject-case": [
2,
"never",
[
"start-case",
"pascal-case"
]
]
}
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
}
=======
.husky/commit-msg
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
yarn commitlint --edit "$#"
=======
.husky/pre-push
#!/usr/bin/env sh
#. "$(dirname -- "$0")/_/husky.sh"
yarn release
git push --follow-tags origin "$(git rev-parse --abbrev-ref HEAD)"
=======
terminal:
$ git add .
$ yarn commit
Select example, feat commit
returned: feat: add new router
$ git push
enter hook pre-push
execute script, but looping pre-push script

How to format / test before every push in a Node.js monorepo?

I am aware of several tools like husky, lint-staged and prettier, currently I have a monorepo that is using yarn workspaces and lerna, before every push using git I want prettier to format my code and run a test script, it does not matter if this happens in every project but it would be nice to only run those scripts in the projects that are changed ofcourse, my question is what tools can really help me with this and how do I set them up? Do I set them up for each project individually or can I setup something in my root package.json? It currently looks like
{
"name": "orgname",
"private": true,
"workspaces": [
"packages/*"
],
"scripts": {
"build": "lerna run build",
"dev": "lerna run start --stream --parallel",
"test": "lerna run test --"
},
"husky": {
"hooks": {
"pre-commit": "npm test"
}
},
"prettier": {
"semi": true,
"singleQuote": true,
"trailingComma": "es5"
},
"devDependencies": {
"lerna": "^3.22.1"
}
}
You can add lint: ... script inside package.json of every lerna packages, for example;
./packages/web/package.json
...
"scripts": {
"lint": "vue-cli-service lint --fix"
},
./packages/api/package.json
...
"scripts": {
"lint": "eslint --fix src",
}
and in the main package.json you can add a lint script that runs every lint command of packages.
Lastly add it to the husky pre-commit hook, so it will run every time before you commit.
./package.json
"scripts": {
"lint": "lerna run lint"
},
"husky": {
"hooks": {
"pre-commit": "yarn lint && yarn test"
}
}
Added a comment to the selected answer about using the lint-staged package, basically it enables you to apply linting and other routines specifically to changed files, and not all the package. It may be useful, depending on how you're using the monorepo approach.
/packages/example-name/.lintstagedrc.json
{
"*.{js,ts}": ["eslint --fix", "git add"]
}
/packages/example-name/package.json
{
[...]
"scripts": {
"precommit": "lint-staged"
}
[...]
}
/package.json
{
[...]
"husky": {
"hooks": {
"pre-commit": "lerna run precommit --since HEAD"
}
},
[...]
}
For more information: https://github.com/okonet/lint-staged

Unable to run Gatsby application using npm run develop command

I am developing my first project with Gatsby and prismic. Today when i tried to start my development server i faced this error. I searched but i couldn't find similar errors anywhere. I am completely blocked on this one and have no clue what's causing this error.
extract from package.json :
"scripts": {
"build-dev": "env-cmd -f .env gatsby build",
"develop-dev": "env-cmd -f .env gatsby develop",
....
},
The error
ERROR
UNHANDLED REJECTION Union type PrismicAllDocumentTypes must define one or more member types.
Error: Union type PrismicAllDocumentTypes must define one or more member types.
- query-compiler.js:202 extractOperations
[site]/[gatsby]/dist/query/query-compiler.js:202:20
- query-compiler.js:176 processQueries
[site]/[gatsby]/dist/query/query-compiler.js:176:7
- query-compiler.js:96 compile
[vav_site]/[gatsby]/dist/query/query-compiler.js:96:19
- index.js:484 async module.exports
[site]/[gatsby]/dist/bootstrap/index.js:484:3
- develop.js:446 async module.exports
[site]/[gatsby]/dist/commands/develop.js:446:7
not finished extract queries from components - 0.675s
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! gatsby-starter-default#0.1.0 develop-dev: `env-cmd -f .env gatsby develop`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the gatsby-starter-default#0.1.0 develop-dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Internal\AppData\Roaming\npm-cache\_logs\2020-03-10T07_36_38_243Z-debug.log
The terminal process terminated with exit code: 1
gatsby version : 2.19.34
react version : 16.13.0
prismic-reactjs version :1.2.0
Have you installed npm install -g gatsby-cli.
[Update] Prismic is not longer recommending the gatsby-source-prismic-graphql plugin.
Here's an article that'll help you migrating to the other one:
How to migrate a project from 'gatsby-source-prismic' to 'gatsby-source-prismic-graphql'
Error says that PrismicAllDocumentTypes has no children. You need to check that your prismic repo has at least one content type and, most important, you have at least one schema added to your codebase and gatsby-config.js:
module.exports = {
plugins: [
{
resolve: `gatsby-source-prismic`,
options: {
repositoryName: `repositoryName`,
accessToken: `accessToken`,
linkResolver: ({ node, key, value }) => post => `/${post.uid}`,
schemas: {
page: require("./src/schemas/page.json"),
},
},
},
],
}
using my own prismic source gatsby package.json file:
{
"name": "gatsby-VARIABLE-prismic",
"description": "YOUR DESCRIPTION",
"private": true,
"license": "MIT",
"version": "0.0.0",
"author": "YOURNAME <YOUR#EMAIL.ADDRESS> (#USERNAME)",
"scripts": {
"build": "gatsby build",
"dev": "gatsby develop -o",
"develop": "gatsby develop",
"serve": "gatsby serve",
"lint": "eslint . --ext .js,.jsx --ignore-path .gitignore",
"lint:fix": "eslint . --ext .js,.jsx --fix --ignore-path .gitignore",
"lint:ci": "yarn lint --format junit -o results/eslint/result.xml",
"format": "prettier \"**/*.md \" --write",
"cy:open": "cypress open",
"cy:run": "cypress run",
"cy:run:ci": "cypress run --browser chrome --reporter junit --reporter-options 'mochaFile=results/cypress/result.xml'",
"test:e2e:dev": "cross-env CYPRESS_SUPPORT=y start-server-and-test dev http://localhost:8000 cy:open",
"test:e2e:run": "cross-env CYPRESS_SUPPORT=y start-server-and-test develop http://localhost:8000 cy:run",
"test:e2e:ci": "cross-env CYPRESS_SUPPORT=y start-server-and-test develop http://localhost:8000 cy:run:ci"
},
"dependencies": {
"#emotion/core": "^10.0.28",
"#emotion/styled": "^10.0.27",
"#emotion/styled-base": "^10.0.28",
"#reach/skip-nav": "^0.8.5",
"emotion": "^10.0.27",
"emotion-server": "^10.0.27",
"emotion-theming": "^10.0.27",
"gatsby": "^2.19.23",
"gatsby-image": "^2.2.41",
"gatsby-plugin-emotion": "^4.1.22",
"gatsby-plugin-google-analytics": "^2.1.36",
"gatsby-plugin-lodash": "^3.1.20",
"gatsby-plugin-manifest": "^2.2.42",
"gatsby-plugin-netlify": "^2.1.33",
"gatsby-plugin-offline": "^3.0.35",
"gatsby-plugin-react-helmet": "^3.1.22",
"gatsby-plugin-sharp": "^2.4.5",
"gatsby-plugin-sitemap": "^2.2.27",
"gatsby-plugin-typography": "^2.3.22",
"gatsby-source-prismic": "^2.2.0",
"gatsby-transformer-sharp": "^2.3.16",
"lodash": "^4.17.15",
"prismic-dom": "^2.1.0",
"prismjs": "^1.19.0",
"prop-types": "^15.7.2",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react-helmet": "^5.2.1",
"react-typography": "^0.16.19",
"typeface-lora": "^0.0.72",
"typeface-source-sans-pro": "^1.1.5",
"typography": "^0.16.19"
},
"devDependencies": {
"#testing-library/cypress": "^5.1.2",
"babel-eslint": "^10.1.0",
"cross-env": "^7.0.0",
"cypress": "^3.8.3",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-cypress": "^2.10.3",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.18.3",
"eslint-plugin-react-hooks": "^2.5.0",
"gatsby-cypress": "^0.2.22",
"prettier": "^1.19.1",
"start-server-and-test": "^1.10.9"
},
"keywords": [
"gatsby",
"starter",
"prismic",
"typography",
"minimal",
"gatsby-starter"
]
}
in your gatsby-condig.js:
resolve: 'gatsby-source-prismic',
options: {
repositoryName: 'gatsby-starter-prismic',
accessToken: `${process.env.API_KEY}`,
// Get the correct URLs in blog posts
linkResolver: () => post => `/${post.uid}`,
// PrismJS highlighting for labels and slices
htmlSerializer: () => prismicHtmlSerializer,
// Remove this config option if you only have one language in your Prismic repository
lang: 'en-gb',
},
},
you are probbly using .dotenv - a way to pass secret keys outside of publc ic repo's.
in your root directory create a file named " .env.develop " and a second: ".env.prod "
.env.develop file content:
API_KEY = COPYPASE YOUR API KEY HERE

Docker - Can't resolve node module in '/usr/src/app/src'

I have this dockerservice:
client/
.dockerignore
Dockerfile-dev
package.json
node_modules/
react-router-dom/
spotify-web-api-js/
and-many-more/
src/
App.jsx
Spotify.js
which installs the following node modules:
package.json
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"axios": "^0.18.0",
"react": "^16.8.2",
"react-dom": "^16.8.2",
"react-router-dom": "^4.3.1",
"react-scripts": "2.1.5",
"spotify-web-api-js": "^0.22.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"devDependencies": {
"enzyme": "^3.8.0",
"enzyme-adapter-react-16": "^1.7.1"
}
}
like so:
Dockerfile-dev
# base image
FROM node:11.6.0-alpine
# set working directory
WORKDIR /usr/src/app
# add `/usr/src/app/node_modules/.bin` to $PATH
ENV PATH /usr/src/app/node_modules/.bin:$PATH
# install and cache app dependencies
COPY package.json /usr/src/app/package.json
RUN npm install --silent
RUN npm install react-scripts#2.1.2 -g --silent
# start app
CMD ["npm", "start"]
at the same path, src, however, I'm observing two different behaviours:
1) this works:
App.jsx
import React, { Component } from 'react';
import { Route, Switch } from 'react-router-dom';
2) but this does not work:
Spotify.js
import React, { Component } from 'react';
import SpotifyWebApi from 'spotify-web-api-js';
throwing the following error:
Failed to compile
./src/Spotify.js
Module not found: Can't resolve 'spotify-web-api-js' in '/usr/src/app/src'
docker-compose-dev.yml
client:
build:
context: ./services/client
dockerfile: Dockerfile-dev
volumes:
- './services/client:/usr/src/app'
- '/usr/src/app/node_modules'
ports:
- 3007:3000
environment:
- NODE_ENV=development
- REACT_APP_WEB_SERVICE_URL=${REACT_APP_WEB_SERVICE_URL}
depends_on:
- web
.dockerignore
node_modules
coverage
build
env
htmlcov
.dockerignore
Dockerfile-dev
Dockerfile-prod
what am I missing?
Hope this helps someone it works for me run
docker-compose down -v
It removes all volumes.

Nuxt.js Webpack Build Error On Heroku

I have a Nuxt.js project to which I added just a few components for now. It runs flawlessly if build local. I wanted to test it on Heroku, however I get some webpack related build errors, in which I bury already 3 days.
remote: ERROR in ./~/babel-loader/lib?{"plugins":["transform-async-to-generator","transform-runtime"],"presets":[["es2015",{"modules":false}],"stage-2"],"cacheDirectory":false}!./~/vue-loader/lib/selector.js?type=script&index=0!./layouts/default.vue
remote: Module not found: Error: Can't resolve '../components/Sidebar/_Sidebar.vue' in '/tmp/build_fe4d2e874dff634cf8c7db3886460988/layouts'
remote: # ./~/babel-loader/lib?{"plugins":["transform-async-to-generator","transform-runtime"],"presets":[["es2015",{"modules":false}],"stage-2"],"cacheDirectory":false}!./~/vue-loader/lib/selector.js?type=script&index=0!./layouts/default.vue 30:0-57
remote: # ./layouts/default.vue
remote: # ./~/babel-loader/lib?{"plugins":["transform-async-to-generator","transform-runtime"],"presets":[["es2015",{"modules":false}],"stage-2"],"cacheDirectory":false}!./~/vue-loader/lib/selector.js?type=script&index=0!./.nuxt/App.vue
remote: # ./.nuxt/App.vue
remote: # ./.nuxt/index.js
remote: # ./.nuxt/server.js
I've also installed a fresh copy the nuxtjs.org starter theme but there is no error. It builds like charm.
This is my package.json
{
"name": "some-nuxt",
"version": "0.3.0",
"description": "nuxt-sandbox ",
"private": true,
"dependencies": {
"axios": "^0.15.3",
"nuxt": "^0.9.9",
"vue-touch": "^2.0.0-beta.4"
},
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
"precommit": "npm run lint",
"heroku-postbuild": "npm run build"
},
"devDependencies": {
"ava": "^0.18.2",
"babel-eslint": "^7.1.1",
"eslint": "^3.16.0",
"eslint-config-standard": "^6.2.1",
"eslint-loader": "^1.6.1",
"eslint-plugin-html": "^2.0.1",
"eslint-plugin-promise": "^3.4.2",
"eslint-plugin-standard": "^2.0.1",
"jsdom": "^9.11.0",
"node-sass": "^4.5.0",
"sass-lint": "^1.10.2",
"sass-loader": "^6.0.2"
}
}
This is some customisations from my nuxt.config.js file.
css: [
// '~assets/css/main.css',
{ src: '~assets/scss/app.scss', lang: 'sass' } // scss instead of sass
],
...
alias: {
'hammerjs$': 'vue-touch/dist/hammer-ssr.js'
},
build: {
/*
** Run ESLINT on save
*/
vendor: ['axios', 'vue-touch'],
extend (config, { isClient }) {
if (isClient) {
config.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /(node_modules)/
})
}
}
},
plugins: ['~plugins/vue-touch']
}
I found the reason that the case sensitive file system Linux of server of Heroku and insensitive system of mine are collided. When I renamed my sub components to uppercase, Github did not push the change to repo.
Neither npm run dev, nor npm run build has given any error in my computer. However when the Linux is looking for the exact names of the folder the problem occured.
This might be a precaution, working on a clean case sensitive formatted partition: https://coderwall.com/p/mgi8ja/case-sensitive-git-in-mac-os-x-like-a-pro
The title of the document explains the best. http://timnew.me/blog/2013/04/18/mac-os-x-case-insensitive-file-system-pitfall/
Adding up to what Gokhan Ozdemir's answer. I've faced a similar issue and realized I had changed a folder's name in a case-sensitive only way.
Example: from fonts to Fonts
It seems that it has to do with mac OS being a case insensitive environment.
I was able to solve it by following these steps:
git mv fonts fonts2
git mv fonts2 Fonts
git commit -m "changed case of dir"
Notice that I had to change to fonts2 initially so that the case-sensitive renaming takes place effectively.
Here's the SO answer explaining the solution to this problem.

Resources