yarn run error : Command failed with exit code 1 - anchor

I was trying to follow this tutorial
This is a tutorial on Solana program dev using anchor and the error rises from using yarn on ubuntu 20.0 i guess
and I got this long error I can't understand
All the help is appreciated
yarn run v1.22.17
warning package.json: No license field
$ /home/sadaf/code/solana-twitter/node_modules/.bin/ts-mocha -p ./tsconfig.json -t 1000000 'tests/**/*.ts'
ReferenceError: TextEncoder is not defined
at Function.fromSecretKey (/home/sadaf/code/solana-twitter/node_modules/#solana/web3.js/src/keypair.ts:66:23)
at Function.local (/home/sadaf/code/solana-twitter/node_modules/#project-serum/anchor/src/nodewallet.ts:13:27)
at Function.env (/home/sadaf/code/solana-twitter/node_modules/#project-serum/anchor/src/provider.ts:79:31)
at Suite.describe (/home/sadaf/code/solana-twitter/tests/solana-twitter.ts:7:38)
at Object.create (/home/sadaf/code/solana-twitter/node_modules/mocha/lib/interfaces/common.js:148:19)
at context.describe.context.context (/home/sadaf/code/solana-twitter/node_modules/mocha/lib/interfaces/bdd.js:42:27)
at Object.<anonymous> (/home/sadaf/code/solana-twitter/tests/solana-twitter.ts:5:1)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Module.m._compile (/home/sadaf/code/solana-twitter/node_modules/ts-node/src/index.ts:439:23)
at Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Object.require.extensions.(anonymous function) [as .ts] (/home/sadaf/code/solana-twitter/node_modules/ts-node/src/index.ts:442:12)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.implementationOfRequireOrImportForUnstableEsm [as requireOrImport] (/home/sadaf/code/solana-twitter/node_modules/mocha/lib/nodejs/esm-utils.js:116:12)
at Object.exports.loadFilesAsync (/home/sadaf/code/solana-twitter/node_modules/mocha/lib/nodejs/esm-utils.js:103:34)
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Updating Node to the latest version solved it for me.

Related

npm elasticsearch-lite on ubuntu 22.04 and rails 7.0.4 CRUD app with react

I was having a lot of trouble with elasticsearch partially because the hard drive on my laptop is filling up I tried making space but I asked myself if maybe there was an elasticsearch lite for development environment only and then I found npm elasticsearch-lite I followed the instructions, installed it, when I run: PORT=9200 ~/node_modules/.bin/elasticsearch I get the following error, even after success running npm install wasi:
$ PORT=9200 ~/node_modules/.bin/elasticsearch
internal/modules/cjs/loader.js:892
throw err;
^
Error: Cannot find module 'wasi'
Require stack:
- /home/fugee/node_modules/elasticsearch-lite/lib.elasticsearch.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
at Function.Module._load (internal/modules/cjs/loader.js:745:27)
at Module.require (internal/modules/cjs/loader.js:961:19)
at require (internal/modules/cjs/helpers.js:92:18)
at /home/fugee/node_modules/elasticsearch-lite/lib.elasticsearch.js:52:34
at Array.forEach (<anonymous>)
at /home/fugee/node_modules/elasticsearch-lite/lib.elasticsearch.js:50:53
at /home/fugee/node_modules/elasticsearch-lite/lib.elasticsearch.js:59:6
at Object.<anonymous> (/home/fugee/node_modules/elasticsearch-lite/lib.elasticsearch.js:360:2)
at Module._compile (internal/modules/cjs/loader.js:1072:14) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/fugee/node_modules/elasticsearch-lite/lib.elasticsearch.js'
]
}

Grunt war task failing in jenkins pipeline

We are using grunt to build our angularjs application.
GruntFile.js contains war:target task to create war file.
Its working locally but not while running jenkins build.
We have 2 different jobs running with following npm and node version.
In 1 job war is getting created and in other war creation failing.
npm info using npm#5.6.0
npm info using node#v8.11.4
Running "war:target" (war) task
Warning: Unexpected token *
Use --force to continue.
Aborted due to warnings.
Stack trace for reference
Warning: Unexpected token * Use --force to continue.
/tmp/workspace/dept-dev-my-angular-app-17486/dept-dev-my-angular-app-17486-my-angular-app-ui.feature-develop/node_modules/readdir-glob/index.js:62
async function* exploreWalkAsync(dir, path, followSyslinks, useStat, shouldSkip, strict) {
^
SyntaxError: Unexpected token *
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/tmp/workspace/dept-dev-my-angular-app-17486/dept-dev-my-angular-app-17486-my-angular-app-ui.feature-develop/node_modules/archiver/lib/core.js:9:12)
Could you please advise on this ?

yarn run ios - Error: Cannot find module - React Native

So, I'm setting up new React Native project, and I'm trying to setup XCode simulator. I've opened my React Native project in XCode and in the terminal when I run "yarn run ios" from a project folder I'm getting the error "Error: Cannot find module '#babel/runtime/helpers/interopRequireDefault'
at Function.Module._resolveFilename".
My-MacBook-Pro-2:projectZero alexs$ yarn run ios
yarn run v1.13.0
$ react-native run-ios
internal/modules/cjs/loader.js:583
throw err;
^
Error: Cannot find module '#babel/runtime/helpers/interopRequireDefault'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/Users/alexs/Desktop/React/Native/projectZero/node_modules/react-native/local-cli/cliEntry.js:11:41)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Module._compile (/Users/alexs/Desktop/React/Native/projectZero/node_modules/pirates/lib/index.js:83:24)
at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Object.newLoader [as .js] (/Users/alexs/Desktop/React/Native/projectZero/node_modules/pirates/lib/index.js:88:7)
at Module.load (internal/modules/cjs/loader.js:599:32)
error Command failed with exit code 1.
Does anybody have an idea how to solve this?
I solved it by running:
yarn add #babel/runtime

Apollo iOS: Command /bin/sh failed with exit code 1 | Command PhaseScriptExecution failed with a nonzero exit code

I follow through installation tutorial by Apollo. And I totally confident that I did everything as is described in installation tutorial. However, when during the build of the project I received the compiler errors like:
TypeError: Cannot read property 'length' of undefined
at Object.yargs.command.command.command.argv [as handler] (/usr/local/lib/node_modules/apollo-codegen/src/cli.js:186:17)
at Object.runCommand (/usr/local/lib/node_modules/apollo- codegen/node_modules/yargs/lib/command.js:235:44)
at Object.parseArgs [as _parseArgs] (/usr/local/lib/node_modules/apollo-codegen/node_modules/yargs/yargs.js:1013:30)
at Object.get [as argv] (/usr/local/lib/node_modules/apollo-codegen/node_modules/yargs/yargs.js:957:21)
at Object.<anonymous> (/usr/local/lib/node_modules/apollo-codegen/lib/cli.js:197:5)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
Command /bin/sh failed with exit code 1
and
++ exec apollo-codegen generate --schema schema.json --output API.swift
TypeError: Cannot read property 'length' of undefined
at Object.yargs.command.command.command.argv [as handler] (/usr/local/lib/node_modules/apollo-codegen/src/cli.js:186:17)
at Object.runCommand (/usr/local/lib/node_modules/apollo-codegen/node_modules/yargs/lib/command.js:235:44)
at Object.parseArgs [as _parseArgs] (/usr/local/lib/node_modules/apollo-codegen/node_modules/yargs/yargs.js:1013:30)
at Object.get [as argv] (/usr/local/lib/node_modules/apollo-codegen/node_modules/yargs/yargs.js:957:21)
at Object.<anonymous> (/usr/local/lib/node_modules/apollo-codegen/lib/cli.js:197:5)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
Command PhaseScriptExecution failed with a nonzero exit code
Why I receive this errors?
After spending a lot of time and did searches I understood why errors appeared. Tanks to #NiltiakSivad for her answer on GitHub issue discussion
Apollo script trying to find a file with the extension .graphql in a project folder with appropriates queries or mutations. If they do not exist, probably you will error as above. I think that Apollo team should warn their audience about such possible case in installation tutorial!
So, in order to successfully run the project make sure:
You're Apollo version compatible with apollo-codegen
You correctly add Apollo script
You have schema.json in the project folder
You have file with the extension .graphql in a project folder that
contains appropriates your schema.json query or mutation

ionic serve error in mac

I'm getting following error when I'm trying to serve the ionic project.
Error: Cannot find module '/Users/SampathM/thotilla/node_modules/#ionic/app-scripts'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/ionic/node_modules/#ionic/cli-utils/lib/ionic-angular/app-scripts.js:9:16)
at Generator.next (<anonymous>)
at /usr/local/lib/node_modules/ionic/node_modules/tslib/tslib.js:107:75
at new Promise (<anonymous>)
at Object.__awaiter (/usr/local/lib/node_modules/ionic/node_modules/tslib/tslib.js:103:16)
at Object.importAppScripts (/usr/local/lib/node_modules/ionic/node_modules/#ionic/cli-utils/lib/ionic-angular/app-scripts.js:7:20)
how to resolve this?
I have had the same problem and I fix it executing :
npm i -g #ionic/app-scripts
after giving root permissions with sudo su
Hope to be helpful

Resources