import fs.default.cp Sync is not a function - javascript

Tried to install TurboRepo, but after selecting npm got this error.
>>> TURBOREPO
>>> Welcome to Turborepo! Let's get you set up with a new codebase.
? Where would you like to create your turborepo? ./my-turborepo
? Which package manager do you want to use? npm
Aborting installation.
Unexpected error. Please report it as a bug:
TypeError: import_fs.default.cpSync is not a function
at run (C:\Users\singh.yogesh\AppData\Roaming\npm-cache\_npx\5504\node_modules\create-turbo\dist\index.js:338:21)
at processTicksAndRejections (internal/process/task_queues.js:95:5)

if you upgrade to node version 16, this error won't appear.

Related

react-native cocoapods Error message : Looks like your iOS environment is not properly set

-When I configure the environment and run the following command
npx react-native init AwesomeProject
Error message
An error occurred while installing json (2.6.3), and Bundler cannot continue.
Make sure that `gem install json -v '2.6.3' --source 'https://rubygems.org/'`
succeeds before bundling.
In Gemfile:
cocoapods was resolved to 1.11.3, which depends on
cocoapods-core was resolved to 1.11.3, which depends on
algoliasearch was resolved to 1.27.5, which depends on
json
✖ Installing Bundler
error Error: Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/next/environment-setup and follow the React Native CLI QuickStart guide for macOS and iOS.
Error: Error: Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/next/environment-setup and follow the React Native CLI QuickStart guide for macOS and iOS.
at createFromTemplate (/opt/homebrew/lib/node_modules/react-native/node_modules/#react-native-community/cli/build/commands/init/init.js:129:11)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Object.initialize [as func] (/opt/homebrew/lib/node_modules/react-native/node_modules/#react-native-community/cli/build/commands/init/init.js:181:3)
at async Command.handleAction (/opt/homebrew/lib/node_modules/react-native/node_modules/#react-native-community/cli/build/index.js:106:9)
info Run CLI with --verbose flag for more details.
I hope that no error will be reported when downloading the project
-Additional information
my Ruby version is :2.7.6
my Mac is :macOs Monterey 12.5.1
my Xcodeis :14.2(14C18)
my pod is : 1.11.3

Error while creating nuxt3 project. Failed to download template from registry

When I use this command to create a new Nuxt 3 project:
npx nuxi init nuxt-app
It outputs this error:
ERROR (node:1752) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time 09:53:25
(Use `node --trace-warnings ...` to show where the warning was created)
ERROR Failed to download template from registry: fetch failed 09:53:25
at /C:/Users/myname/AppData/Local/npm-cache/_npx/a95e0f536cf9a537/node_modules/nuxi/dist/chunks/init.mjs:13269:11
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async downloadTemplate (/C:/Users/myname/AppData/Local/npm-cache/_npx/a95e0f536cf9a537/node_modules/nuxi/dist/chunks/init.mjs:13268:20)
at async Object.invoke (/C:/Users/myname/AppData/Local/npm-cache/_npx/a95e0f536cf9a537/node_modules/nuxi/dist/chunks/init.mjs:13336:15)
at async _main (/C:/Users/myname/AppData/Local/npm-cache/_npx/a95e0f536cf9a537/node_modules/nuxi/dist/cli.mjs:50:20)
My environments:
Operating System: Windows 11
node version : 18.12.0
npm version: 8.12.1
At first I suspected that this was due to my network. But I didn't get an error when I tried to install other npm packages.
I got the same issue while working at a client (bank), this is mainly a network restriction indeed. They are limiting the access to only a few NPM packages and this one is not whitelisted (mainly the template).
Not sure how to properly bypass it other than manually getting the code with an SSH/HTTP clone or maybe asking them to allow that specific endpoint.
I found the reason in here.
It's indeed a network issue. It couldn't access raw.githubusercontent.com from the command line because it couldn't find the corresponding IP address.
After adding the correct ip address of raw.githubusercontent.com to the Windows hosts file, the issue was fixed
You can also resolve it by switch your network, like if you on using a wi-fi, please change it with another.

React Native app cant install package with Solana dependency

Installing a package that requires solanaweb3js in React Native throws an error.
I found that i am not alone with this but i could not make the provided solutions work for me.
Error:
Error: Unexpected token name «n», expected punc «,» in file node_modules/solana-test-package/node_modules/#solana/web3.js/lib/index.native.js at 4581:32
at /Users/darjusch/development/solana/wallet-sdk/node_modules/metro-transform-worker/src/index.js:279:15
at Generator.next (<anonymous>)
at asyncGeneratorStep (/Users/darjusch/development/solana/wallet-sdk/node_modules/metro-transform-worker/src/index.js:146:24)
at _next (/Users/darjusch/development/solana/wallet-sdk/node_modules/metro-transform-worker/src/index.js:168:9)
at /Users/darjusch/development/solana/wallet-sdk/node_modules/metro-transform-worker/src/index.js:175:7
at new Promise (<anonymous>)
at /Users/darjusch/development/solana/wallet-sdk/node_modules/metro-transform-worker/src/index.js:164:12
at minifyCode (/Users/darjusch/development/solana/wallet-sdk/node_modules/metro-transform-worker/src/index.js:289:17)
at Object.<anonymous> (/Users/darjusch/development/solana/wallet-sdk/node_modules/metro-transform-worker/src/index.js:569:40)
info Run CLI with --verbose flag for more details.
> Task :app:bundleReleaseJsAndAssets FAILED
FAILURE: Build failed with an exception.
Reproducing the error:
Gitclone:
https://github.com/Darjusch/AwesomeProject
OR
npx react-native init AwesomeProject
npm i solana-test-package
I uploaded that npm packge to reproduce the issue:
https://github.com/Darjusch/solana-test-package
This is the content of the package:
index.js
const { Keypair } = require('#solana/web3.js');
export function generateKeypair() {
const keypair = Keypair.generate();
console.log(`Generated Solana publickey is ${keypair.publicKey.toBase58()}`);
return keypair;
}
package.json
"dependencies": {
"#solana/web3.js": "^1.54.0"
}
Any help appriciated!
That error implies that your JavaScript runtime does not understand BigInt literals (eg. 2n). Newer runtimes like Hermes circa React Native 0.70.0 added support for them.
Follow the updated React Native project initialization instructions at https://solanacookbook.com/integrations/react-native.html#how-to-use-solana-web3-js-in-a-react-native-app

error An unexpected error occurred: "EPERM: operation not permitted, unlink 'path_to_project\\node_modules\\prisma\\query_engine-windows.dll.node'

I installed Prisma and I run npx primsa db push it pushed all tables to database successfully, after that I run npx prisma generate it tried to install #prisma/client and it fails with this error message:
error An unexpected error occurred: "EPERM: operation not permitted, unlink 'path_to_project\node_modules\prisma\query_engine-windows.dll.node'
I tried to remove node_modules and re-install all modules but it not worked.
I had to install #prisma/client manually with yarn add #prisma/client then run npx prisma generate it works perfectlly.
I had this same error type with a different package. In my case the thing that was causing the error was because it couldn't access the folder while the app was still running ie. from this issue https://github.com/yarnpkg/yarn/issues/2685
This was following npm cache clean --force not resolving it.
I had the same error but after installing Microsoft Visual C++ 2015 Redistributable it works fine now
Stopping my docker container running and closing vs code and reopening it, solved it for me.
Closing all processes and re-running the command worked for me.

expo init <project name> throwing npm ERROR (windows OS)

Just started with expo and React-Native and when I run
expo init ProjectName
I am getting an error stating:
Unexpected end of JSON input while parsing near '...,"version":"7.0.0-bet'
Process exited with non-zero code: 1
Set EXPO_DEBUG=true in your env to view the stack trace.
When I add the said thing in env (using set EXPO_DEBUG=true on windows), I get the following error:
Error: Process exited with non-zero code: 1
at ChildProcess.child.on (C:\Users\mohit\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\spawn-async\build\spawnAsync.js:39:21)
at ChildProcess.emit (events.js:182:13)
at ChildProcess.cp.emit (C:\Users\mohit\AppData\Roaming\npm\node_modules\expo-cli\node_modules\cross-spawn\lib\enoent.js:40:29)
at maybeClose (internal/child_process.js:962:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
It's something related to 'spawn-async'. I was also getting issues with 'spawn' sometime earlier while creating a node-server...but I resolved that there and then using 'exec' instead. Tried to find this on expo forums and even in react-native issues but couldn't find a solution. Can someone plz suggest something? Is it some "windows" thing only or something related to npm releases?
P.S: I also ran create-react-native-app ProjectName and again got a similar kind of error about end of JSON input!
Now I know what can be the issue, it can be just the trivial one:
Please update node an npm to the newest available version and please init you project again in different directory.
You'll need to have Node.js (version 10 or newer) installed on
your computer. Download the latest version of Node.js.
Additionally, you'll need Git to create new projects with Expo
CLI. You can download Git from here.
Make sure that you have installed these two things in your device.
Go to doc for expo installation
in my case. make sure you have yarn installed and update tour android studio packages, for it to work

Categories