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

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 .

Related

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"
},
}

Once i create and use own module then it will gives error like: Unable to resolve module

I am new in react-native and I have, for the first time, created my own module(npm).
I have tried to create my own module(npm) for common components and individually it works fine. However once I install, link it in our app, and try to use those components, it gives an error like this:
Unable to resolve module `<Module-name>` from `<file>`: Module `<Module-name>` does not exist in the Haste module map.
(Note: I have tested using Android Emulator only)
I have followed the below steps for module and test app creation
For Module
react-native init <module-name>
Add simple code of component in main index.js
And set pacakge.json like this:
{
"name": "<module-name>",
"version": "0.0.1",
"private": true,
"main": "index.js",
"scripts": {
"start": "react-native start",
"test": "jest",
"lint": "eslint .",
"build": "echo 'build script executed'"
},
"dependencies": {
"react": "16.8.6",
"react-native": "0.60.4"
},
Now I check this component (react-native run-android), it will work fine.
Now I have tried to use in an app with the below steps
For Test App
Create new fresh app (react-native init <app-name>)
Install created npm with full path like;
npm install <full path of component>
Now I try react-native link <full path of component>, I have also tried simple react-native link, but nothing happens.
Now I run app using react-native run-android, however every time it gives the same error like;
Unable to resolve module <created-module name>
test app package.json
{
"name": "<app-name>",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"react": "16.8.6",
"react-native": "0.60.4",
"react-native-my-library": "^1.0.2",
"<created-module-name>": "file:../<created-module-name>"
},
"devDependencies": {
"#babel/core": "7.5.5",
"#babel/runtime": "7.5.5",
"#react-native-community/eslint-config": "0.0.3",
"babel-jest": "24.8.0",
"eslint": "6.1.0",
"jest": "24.8.0",
"metro-react-native-babel-preset": "0.54.1",
"react-test-renderer": "16.8.6"
},
"jest": {
"preset": "react-native"
}
}
Created module successfully installed but I think it is not linked properly and it will gives error.
So what is wrong here ?
Please give me suggestion / help.
Thanks.
I am assuming your module is successfully published in npm repository. Otherwise you can not use npm install <full path of component>.
If you are using
npm install <full path of component>
command for installing your module to a Test App from npm repo. Specify in your package.json like
"<created-module-name>": "file:../<created-module-name>"
is wrong. You need to remove that line from your package.json and try to install like;
npm install --save <full path of component>
This will automatically create a line in your package.json. You can now manually link your module.
For manual linking you can follow that guide.
Edited:
If you are using in your local computer,
Then no need to npm install.
Just copy your module into your project node_modules folder.
Then in you package.json add;
"dependencies": {
...
"your_module_name": "your_module_version"
...
}
Then, you just follow the manual linking process that I mentioned above.

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

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.

react-native init AwesomeProject - fails to build

I cannot get a vanilla react-native project to build immediately after running react-native init. I have not made any changes to the project, nor run other commands.
Commands/output:
> react-native init AwesomeProject
> cd AwesomeProject
> react-native run-ios
....
** BUILD FAILED **
The following commands produced analyzer issues:
Analyze Base/RCTModuleMethod.mm normal x86_64
Analyze RCTVibration.m normal x86_64
(2 commands with analyzer issues)
The following build commands failed:
CompileC build/RCTVibration.build/Debug-iphonesimulator/RCTVibration.build/Objects-normal/x86_64/RCTVibration.o RCTVibration.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/AwesomeProject57.app
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=164):
Unable to lookup in current state: Shutdown
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/AwesomeProject57.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/AwesomeProject57.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
at checkExecSyncError (child_process.js:601:13)
at Object.execFileSync (child_process.js:621:13)
at Promise.then (/Users/local/common/native-attempt/AwesomeProject57/node_modules/react-native/local-cli/runIOS/runIOS.js:208:5)
at <anonymous>
Mac OS X: 10.3.4
XCode: 9.4.1
react-native: 0.57
react: 16.5.0
package.json:
{
"name": "AwesomeProject",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.5.0",
"react-native": "0.57.0"
},
"devDependencies": {
"babel-jest": "23.6.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.45.2",
"react-test-renderer": "16.5.0"
},
"jest": {
"preset": "react-native"
}
}
After looking around StackOverflow, I tried:
rm -rf node_modules
rm -fr $TMPDIR/react-*
watchman watch-del-all
Using react-native run-ios still failed. FWIW, I did open the project in XCode and tried to build it there. I received a build error "/Users/local/common/native-attempt/AwesomeProject/node_modules/react-native/Libraries/Text/RawText/RCTRawTextViewManager.h:8:9: 'React/RCTViewManager.h' file not found". Different error, but I assume it is related.
Really pulling my hair out... any help appreciated.

nodemon not working

When i run nodemon, it shows
[nodemon] 1.17.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node app.js`
But when i run npm start, everything works fine. Why is nodemon not working
my package.json
{
"name": "sarthakmedia",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"body-parser": "^1.18.3",
"cookie-parser": "~1.4.3",
"cors": "^2.8.4",
"debug": "~2.6.9",
"express": "~4.16.0",
"express-mysql-session": "^1.3.0",
"express-session": "^1.15.6",
"git": "^0.1.5",
"http-errors": "~1.6.2",
"jade": "~1.11.0",
"morgan": "~1.9.0",
"mysql": "*",
"nodemon": "^1.17.4",
"pug": "2.0.0-beta11"
},
"description": "practise",
"main": "app.js",
"devDependencies": {},
"author": "Anita",
"license": "ISC"
}
The api's don't get called at all. nodemon starts fine though
try this
first step
in package.json file
"scripts":{
"start":"node app",
"dev":"nodemon app"
}
second step
install nodemon as devdependencies
using code npm i -D nodemon
3)in app.js file
const express = require("express");
const app = express();
// routes
app.get("/",(req,res)=>{
res.send("hello");
});
// server started
const port =process.env.PORT || 5000;
app.listen(port,()=>{
console.log("server started at port 5000");
});
4)fourth step
use (npm run dev) in command line tool
Nodemon starts by running the file ./app.js.
But your start npm script (which works according to your question) runs a different file ./bin/www/index.js.
I think you should tell nodemon what file is your entry point.
Thus, you should edit the "main" entry in your package.json with the same value, e.g., ./bin/www. In fact, nodemon reads this value in your package.json in order to know what file to start with.
Just run your app with nodemon -w ./ when you are in app root directory.
-w stands for looking at the directory rather than 1 JS file. It is usefu; when you have more than 1 js you need to mon