Yarn installed through brew but when I find yarn version it came a error - yarnpkg

yarn -v
node:internal/modules/cjs/loader:998
throw err;
^
Error: Cannot find module '/Users/sadeepa/.yarn/releases/yarn-3.3.1.cjs'
at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
at Module._load (node:internal/modules/cjs/loader:841:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v18.12.1
Any one please help? Thanks
I want to reinstall yarn because of some problems then I tried to uninstall all the yarn things and install again so I get errors

Hi I have got the same problem
ubuntu#ip-xxx-xx-x-xxx:~/yarn
node:internal/modules/cjs/loader:988
throw err;
^
Error: Cannot find module '/home/ubuntu/.yarn/releases/yarn-3.3.1.cjs'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
at Function.Module._load (node:internal/modules/cjs/loader:833:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:22:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
and I found the file named .yarnrc.yml and remove it
ubuntu#ip-xxx-xx-x-xxx:~$ cat .yarnrc.yml
yarnPath: .yarn/releases/yarn-3.3.1.cjs
ubuntu#ip-xxx-xx-x-xxx:~$ rm .yarnrc.yml
ubuntu#ip-xxx-xx-x-xxx:~$ yarn
yarn install v1.22.19
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 0.07s.
ubuntu#ip-xxx-xx-x-xxx:~$ yarn -v
1.22.19

Related

"SyntaxError: Unexpected end of input" raised in near-vm folder during near-sdk-as yarn installment

When I tried to install near-sdk-as on my laptop (Intel-based macOS 10.13) with the command:
yarn add -D near-sdk-as
I got the following error:
❯ yarn add -D near-sdk-as
yarn add v1.22.17
info No lockfile found.
[1/4] 🔍 Resolving packages...
warning near-sdk-as > near-sdk-core > near-vm > binary-install > axios#0.19.2: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
warning "near-sdk-as > near-sdk-core > #as-pect/cli#6.2.4" has incorrect peer dependency "assemblyscript#^0.19.3".
warning "near-sdk-as > near-sdk-core > #as-pect/cli > #as-pect/assembly#6.2.0" has incorrect peer dependency "assemblyscript#^0.19.3".
warning "near-sdk-as > near-sdk-core > #as-pect/cli > #as-pect/core#6.2.1" has incorrect peer dependency "assemblyscript#^0.19.3".
[4/4] 🔨 Building fresh packages...
error /Users/admin/Develop/Learn-Near/NEAR-101/node_modules/near-vm: Command failed.
Exit code: 1
Command: node ./install.js
Arguments:
Directory: /Users/admin/Develop/Learn-Near/NEAR-101/node_modules/near-vm
Output:
/Users/admin/Develop/Learn-Near/NEAR-101/node_modules/follow-redirects/node_modules/debug/src/debug.js:47
hash = ((hash <
SyntaxError: Unexpected end of input
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1032:15)
at Module._compile (node:internal/modules/cjs/loader:1067:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/Users/admin/Develop/Learn-Near/NEAR-101/node_modules/follow-redirects/node_modules/debug/src/node.js:14:28)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Other info:
npm version: 8.3.1
yarn version: v1.22.17
Any thoughts on how to fix the error and complete the sdk installation?
Thanks!
Try yarn cache clean --force first, then rerun yarn.
Why? You have broken dependency files cached, so you want to clean the cache and download from scratch

Module not found if installing a package in global with pnpm

I am trying to install prettier with pnpm install prettier -g, and when I tried to run it in the terminal, it gives me the following error:
node:internal/modules/cjs/loader:944
throw err;
^
Error: Cannot find module '/Users/hugosum/pnpm-global/5/node_modules/prettier/bin-prettier.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:941:15)
at Function.Module._load (node:internal/modules/cjs/loader:774:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
When I do which prettier, it gives me /usr/local/bin/prettier. How can I further debug and solve this issue?
Solved this by cleaning up duplicating binary in /usr/local/bin

Jupyterlab Plotly extension install: JupyterLab failed to build

I try to install Plotly extension to Jupiterlab. After I installed every package (Anaconda, jupyterlab "ipywidgets>=7.5") I try to install "jupyter labextension install jupyterlab-plotly#4.14.3" but I got an error message: RuntimeError: JupyterLab failed to build
I try to identify the problem from the Log file, but I have no idea what to do next
The log file:
Yarn configuration loaded.
Node v15.12.0
"C:\Users\Szarka Roland\anaconda3\npm.CMD" pack jupyterlab-plotly#4.14.3
npm notice
npm notice package: jupyterlab-plotly#4.14.3
npm notice === Tarball Contents ===
npm notice 156B README.md
npm notice 6.3kB dist/javascript-renderer-extension.js
npm notice 1.0kB package.json
npm notice 545B style/index.css
npm notice 1.0kB style/plotly.svg
npm notice === Tarball Details ===
npm notice name: jupyterlab-plotly
npm notice version: 4.14.3
npm notice filename: jupyterlab-plotly-4.14.3.tgz
npm notice package size: 3.1 kB
npm notice unpacked size: 9.1 kB
npm notice shasum: bb424a50226c2ce1b816f061a8123f0f42418fc0
npm notice integrity: sha512-6ZdmIQ5fDiBTY[...]nASwRNCf1U1Cg==
npm notice total files: 5
npm notice
jupyterlab-plotly-4.14.3.tgz
Yarn configuration loaded.
Node v15.12.0
Building jupyterlab assets (build:prod:minimize)
> node "C:\Users\Szarka Roland\anaconda3\lib\site-packages\jupyterlab\staging\yarn.js" install --non-interactive
yarn install v1.15.2
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info fsevents#1.2.11: The platform "win32" is incompatible with this module.
info "fsevents#1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning "jupyterlab-plotly > #lumino/widgets > #lumino/coreutils#1.5.3" has unmet peer dependency "crypto#1.0.1".
[5/5] Building fresh packages...
success Saved lockfile.
Done in 9.81s.
> node "C:\Users\Szarka Roland\anaconda3\lib\site-packages\jupyterlab\staging\yarn.js" yarn-deduplicate -s fewer
yarn run v1.15.2
error Command "yarn-deduplicate" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
> node "C:\Users\Szarka Roland\anaconda3\lib\site-packages\jupyterlab\staging\yarn.js"
yarn install v1.15.2
[1/5] Validating package.json...
[2/5] Resolving packages...
success Already up-to-date.
Done in 0.52s.
> node "C:\Users\Szarka Roland\anaconda3\lib\site-packages\jupyterlab\staging\yarn.js" run build:prod:minimize
yarn run v1.15.2
$ ensure-max-old-space webpack --config webpack.prod.minimize.config.js
node:internal/modules/cjs/loader:352
throw err;
^
Error: Cannot find module 'C:\Users\Szarka Roland\anaconda3\share\jupyter\lab\staging\node_modules\which\which.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (node:internal/modules/cjs/loader:344:19)
at Function.Module._findPath (node:internal/modules/cjs/loader:557:18)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:910:27)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Module.require (node:internal/modules/cjs/loader:996:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (C:\Users\Szarka Roland\anaconda3\share\jupyter\lab\staging\node_modules\#jupyterlab\buildutils\lib\ensure-max-old-space.js:28:28)
at Module._compile (node:internal/modules/cjs/loader:1092:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
at Module.load (node:internal/modules/cjs/loader:972:32) {
code: 'MODULE_NOT_FOUND',
path: 'C:\\Users\\Szarka Roland\\anaconda3\\share\\jupyter\\lab\\staging\\node_modules\\which\\package.json',
requestPath: 'which'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
JupyterLab failed to build
Traceback (most recent call last):
File "C:\Users\Szarka Roland\anaconda3\lib\site-packages\jupyterlab\debuglog.py", line 47, in debug_logging
yield
File "C:\Users\Szarka Roland\anaconda3\lib\site-packages\jupyterlab\labextensions.py", line 105, in start
command=command, app_options=app_options)
File "C:\Users\Szarka Roland\anaconda3\lib\site-packages\jupyterlab\commands.py", line 459, in build
command=command, clean_staging=clean_staging)
File "C:\Users\Szarka Roland\anaconda3\lib\site-packages\jupyterlab\commands.py", line 669, in build
raise RuntimeError(msg)
RuntimeError: JupyterLab failed to build
Exiting application: jupyter

Failed to get yarn configuration while installing Jupyter Lab in Cygwin

I am trying to install some extensions for jupyterlab in Cygwin. So I type, for example, jupyter labextension install #jupyter-widgets/jupyterlab-manager in the Cygwin command prompt. But I get an error. Here's the log:
Fail to get yarn configuration. internal/module/cjs/loader.js:968
throw err;
^
Error: Cannot find module 'C:\home\<user>\<path_to_venv>\lib\python3.8\site-packages\jupyterlab\staging\yarn.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
at Function.Module._load (internal/modules/cjs/loader.js:841:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND,
requireStack: []
}
Fail to get yarn configuration. internal/module/cjs/loader.js:968
throw err;
^
Error: Cannot find module 'C:\home\<user>\<path_to_venv>\lib\python3.8\site-packages\jupyterlab\staging\yarn.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
at Function.Module._load (internal/modules/cjs/loader.js:841:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND,
requireStack: []
}
An error occured.
OSError: [Errno 16] Device or resource busy: '/tmp/tm1da390j3'
See the log file for details: /tmp/jupyterlab-debug-mgr2ux9k.log
I understand the error: instead of looking for C:\cygwin64\home\<user>\<path_to_venv>\lib\python3.8\site-packages\jupyterlab\staging\yarn.js the installation manager looks for C:\home\<user>\<path_to_venv>\lib\python3.8\site-packages\jupyterlab\staging\yarn.js. I just don't know how to fix it. Maybe I need to edit some configuration files. I would be very grateful for your help.

npm install successfully but node web.js erros w: "Error: Cannot find module"

I'm working to get node running on a new mac. I downloaded the installed at http://nodejs.org/
I then git cloned my node repo, ran npm install and npm update, and then node web.js which then errors with:
$ node web.js
Error: Cannot find module '/Users/me/Sites/mysite-node/node_modules/pg/lib/native/../../build/default/binding'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (/Users/me/Sites/mysite-node/node_modules/pg/lib/native/index.js:12:12)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
I'm new to node, any ideas or suggestions on where to look? Thanks
You need to install the postgresql libraries on your machine. For example under Fedora you'd:
yum install postgresql.x86_64
yum install postgresql-server.x86_64
If you already had pg install you'd need to rebuild it:
npm rebuild pg
Then to verify everything is working at the terminal type:
node
Then in the node REPL type:
var pg = require('pg').native
And you shouldn't get an error
The Error shows that npm installation of the pg module has not built the native bindings properly. Modify your code as follows:
//var pg = require('pg').native;
var pg = require('pg');

Resources