'gatsby build' failing in Travis CI - error #98123 WEBPACK - npm

I'm trying to deploy my portfolio website using AWS S3, CloudFront, CodePipeline, and Travis CI.
Everything works fine, but Travis CI build keeps failing.
gatsby build gives me an error with:
error #98123 WEBPACK
Generating JavaScript bundles failed
This question is very similar to mine, but the solution was irrelevant to mine because I don't have yarn file and I tried reinstalling my npm dependencies.
Here is the copy of my logs:
Generating JavaScript bundles failed
Can't resolve '../components/Layout' in '/home/travis/build/stomg7969/react-portfolio/src/pages'
File: src/pages/index.js
See our docs page for more info on this error: https://gatsby.dev/issue-how-to
error #98123 WEBPACK
Generating JavaScript bundles failed
Can't resolve '../components/Layout' in '/home/travis/build/stomg7969/react-portfolio/src/pages'
File: src/pages/404.js
See our docs page for more info on this error: https://gatsby.dev/issue-how-to
The command "gatsby clean && gatsby build" exited with 1.
store build cache
Done. Your build exited with 1.
And here is my package.json.
"name": "gatsby-starter-spectral",
"version": "0.0.1",
"description": "Gatsby.js V2 starter template based on Spectral by HTML5 UP",
"repository": {
"type": "git",
"url": "git+https://github.com/anubhavsrivastava/gatsby-starter-spectral.git"
},
"author": {
"name": "Anubhav Srivastava",
"email": "anubhav.srivastava00#gmail.com"
},
"dependencies": {
"gatsby": "^2.13.39",
"gatsby-plugin-manifest": "^2.2.3",
"gatsby-plugin-offline": "^2.1.0",
"gatsby-plugin-react-helmet": "^3.0.12",
"gatsby-plugin-sass": "^2.0.11",
"node-sass": "^4.12.0",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-helmet": "^5.2.1",
"react-images": "1.0.0",
"react-scrollspy": "^3.4.0",
"smoothscroll-polyfill": "^0.4.4"
},
"scripts": {
"develop": "gatsby develop",
"build": "npm run clean && gatsby build",
"deploy": "npm run clean && gatsby build --prefix-paths && gh-pages -d public",
"serve": "gatsby serve",
"clean": "rimraf .cache public",
"format": "prettier --write '**/*.js'",
"test": "echo \"Error: no test specified\" && exit 1"
},
"devDependencies": {
"gh-pages": "^2.0.1",
"prettier": "^1.17.0",
"rimraf": "^2.6.3"
},
"keywords": [
"gatsby",
"gatsby-starter",
"gatsby-starter-spectral"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/anubhavsrivastava/gatsby-starter-spectral/issues"
},
"homepage": "https://github.com/anubhavsrivastava/gatsby-starter-spectral#readme"
}
Lastly, this is my .travis.yml file.
language: node_js
node_js:
- 11.8.0
install: npm install
script: gatsby clean && gatsby build
deploy:
provider: s3
access_key_id: $AWS_KEY
secret_access_key: $AWS_SECRET
bucket: 'thedevelopark.com'
skip_cleanup: true
acl: public_read
local_dir: public
Thank you in advance for your feedback.

I've had the same problem and tried and checked case-sensitivity a thousand times. Wouldn't do anything.
Then I changed the name of the component in all areas, filename, import, export, you name it. Now it works.
I don't know if Netlify had a problem with my component's name "Socials"? Guess I'll never find out.

Related

HardHat: Nothing to compile

When compiling the hardhat project When it's showing Nothing to Compile.
{
"name": "HardhAtToken",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"#nomiclabs/hardhat-ethers": "^2.0.6",
"#nomiclabs/hardhat-waffle": "^2.0.3",
"chai": "^4.3.6",
"ethereum-waffle": "^3.4.4",
"ethers": "^5.6.6",
"hardhat": "^2.9.6-dev.1"
},
"dependencies": {
"glob": "^7.2.0"
}
}
Hardhat keeps a cache of compiled contracts in the cache project folder.
The npx hardhat compile command only compiles files that have not been changed since the last compilation. So the "nothing to compile" message is expected in your case.
You can either clear the cache using npx hardhat clean, or force recompilation of cached sources using the npx hardhat compile --force argument.
Docs: https://hardhat.org/guides/compile-contracts.html
The major issue with that you haven't created a contracts directory in your code.Then you can implement sol file in it and run npx hardhat compile..It was worked for me...

Next.js - yarn dev: error Command failed with signal "SIGSEGV"

I am having this problem, whenever I am running yarn dev or npm run dev:
yarn run v1.22.10
warning ../../../../package.json: No license field
$ next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Using webpack 5. Reason: no next.config.js https://nextjs.org/docs/messages/webpack5
event - compiled successfully
event - build page: /
wait - compiling...
error Command failed with signal "SIGSEGV".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
package.json:
{
"name": "nextjs",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "^10.2.3",
"react": "17.x",
"react-dom": "17.x",
"webpack": "^5.39.1"
},
"devDependencies": {
"webpack-cli": "^4.7.2"
}
}
Appears to be a problem with Mac M1, as #Fernando Gomes commented.
In order to get it working on my environment, I am using Docker with following parameters:
docker buildx build --platform linux/amd64 .

How do you deploy api made with express in create react app

I have a simple api created with express.js. When ever i try to push to Heroku it get stuck at this point?
remote: [4/4] Building fresh packages...
remote: Done in 16.30s.
remote:
remote: -----> Build
remote: Running build (yarn)
remote: yarn run v1.22.4
remote: $ node server.js
remote: Server started on port 9000
I also see the same thing in heroku dashboard "View build progress"
here is my package.json
{
"name": "firebase-server",
"version": "1.0.0",
"main": "index.js",
"repository": "##########",
"author": "#######",
"license": "MIT",
"scripts": {
"start": "nodemon --ext js,graphql --ignore data/ server.js",
"build": "node server.js"
},
"dependencies": {
"#firebase/app": "^0.6.7",
"#firebase/component": "^0.1.15",
"apollo-server-express": "^2.15.1",
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"express-jwt": "^6.0.0",
"firebase": "^7.15.5",
"graphql": "^15.3.0",
"jsonwebtoken": "^8.5.1",
"notarealdb": "^0.2.2"
},
"devDependencies": {
"nodemon": "^2.0.4"
}
}
the only thing i have in this project is my server.js. what am i missing or not doing. Basically i trying to deploy this to have a live API for my project. it is working locally but now i would like to have it working live on heroku.
With Heroku, the build script is used if you need to customize your build options (e.g. if you're using WebPack or TypeScript). The issue is that you're using a script called build, which you're expecting to start the application. It's running that script, as it promises to do, but since it's starting the application, it'll "hang forever" from your point of view.
If you change your scripts to this, I think this will solve your issues. Locally, you would use npm local for nodemon, and npm start would start the app on Heroku.
{
"scripts": {
"local": "nodemon --ext js,graphql --ignore data/ server.js",
"start": "node server.js"
},
}

How to modify scripts section to exclude/skip scenarion with tag #ignore in package.json

I need to run cucumber tests using puppeteer and chai but exclude that scenario that has tag #ignore.
This should be probably set up in package.json under scripts and "test" line. But I donĀ“t know how...
Here is code
{
"name": "cucumber-puppeteer-example",
"description": "Example project on how to use cucumber with puppeteer",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"build": "rimraf build out && tsc",
"build:watch": "rimraf build && tsc -w",
"test": "cucumber-js --require \"build/**/*.js\"",
"test:headless": "cross-env CLS_TEST_HEADLESS=false cucumber-js --require \"build/**/*.js\"",
"test:local": "rimraf out && cross-env CLS_TEST_HEADLESS=false CLS_TEST_URL=http://localhost:4200 cucumber-js --require \"build/**/*.js\"",
"e2e": "ts-node",
"chromium": "ts-node ci-chromium-install.ts linux 641577",
"lint": "tslint --project tsconfig.json -c tslint.json"
},
"devDependencies": {
"#types/chai": "4.1.7",
"#types/cucumber": "4.0.5",
"#types/puppeteer": "1.12.3",
"chai": "4.2.0",
"chromium": "^2.1.0",
"cross-env": "5.2.0",
"cucumber": "5.1.0",
"puppeteer": "1.14.0",
"ts-node": "8.0.3",
"tslint": "^5.16.0",
"tslint-no-unused-expression-chai": "^0.1.4",
"typescript": "3.3.4000",
"unzip": "0.1.11"
}
}
Anyone know how to put somthing like this ~#ingore to ignore all tagged scenarios here to package.json?
Create a separate class with the name cucumberOpts.ts/ js like below:
{
"compiler": "ts:ts-node/register",
"projectName": {
"tags": {
"ui": ["#Ui", "~#Ignore"],
"api": ["#Api", "~#Ignore"]
}
}
}
and use this class in your package.json file like as below:
"scripts": {
"e2e": "cucumber-js ./src/test/features --cucumberOpts.compiler -f node_modules/cucumber-pretty --format json:cucumber-json-report.json --cucumberOpts.projectName.tags.ui"
}
Use #Ignore tag before your scenario which you need to skip and run 'npm run e2e' command from your terminal. This will consider all scenario's which are tagged wit #Ui and will skip all the features which are tagged with #Ignore. If you include both the tags for same scenario, that scenario will be skipped
Add a before step to your hook and return 'pending'

How do I configure npm packages using a package list? Like Bower

I'm a big fan of bower. I don't need to put a stack of packages in my repository, I just commit bower.json each time and I'm done.
So my question really is, can I make npm read from a json file in the same way that bower does?
npm has package.json. This file has dependencies and devDependencies parts. You can use this file similar to bower.json.
npm install
will install necessary dependencies to your project's node_modules directory.
See sample package.json below.
{
"name": "SampleMobileApp",
"version": "0.0.1",
"description": "Sample App",
"dependencies": {
"grunt": "~0.4.2",
},
"devDependencies": {
"grunt": "~0.4.2",
"grunt-contrib-jshint": "~0.8.0",
"grunt-open": "~0.2.3",
"grunt-contrib-copy": "~0.5.0",
"grunt-bowercopy": "~0.7.1",
"grunt-contrib-watch": "~0.5.3",
"grunt-phonegap": "~0.12.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"grunt",
"javascript"
],
"author": "Atilla Ozgur",
"license": "MIT",
}
dependencies are your runtime dependencies that your users need to download while devDependencies are your developer dependencies like your test runtime, grunt helper packages etc.