Can't open VS Code on Ubuntu - javascript

Since today, I can't open vs code on both App shortcut and Terminal.
When I try to run any command related to VS Code like code, code --version and etc. I get this error:
Loading "minimist" failed
Error: EIO: i/o error, read
at Object.readSync (fs.js:592:3)
at Object.p.internalModuleReadJSON (electron/js2c/asar_bundle.js:5:11493)
at Object.read (internal/modules/package_json_reader.js:21:52)
at readPackage (internal/modules/cjs/loader.js:253:36)
at resolveExports (internal/modules/cjs/loader.js:436:15)
at Function.Module._findPath (internal/modules/cjs/loader.js:479:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:921:27)
at Module._load (internal/modules/cjs/loader.js:779:27)
at Function.f._load (electron/js2c/asar_bundle.js:5:12913)
at Module.require (internal/modules/cjs/loader.js:1006:19)
at require (internal/modules/cjs/helpers.js:88:18)
at r (/snap/code/83/usr/share/code/resources/app/out/vs/loader.js:5:101)
at e.load (/snap/code/83/usr/share/code/resources/app/out/vs/loader.js:4:1723)
at e.load (/snap/code/83/usr/share/code/resources/app/out/vs/loader.js:3:10695)
at d (/snap/code/83/usr/share/code/resources/app/out/vs/loader.js:5:10300)
at Object.errorback (/snap/code/83/usr/share/code/resources/app/out/vs/loader.js:5:10421)
at e.triggerErrorback (/snap/code/83/usr/share/code/resources/app/out/vs/loader.js:3:11059)
at /snap/code/83/usr/share/code/resources/app/out/vs/loader.js:3:10765
at e.load (/snap/code/83/usr/share/code/resources/app/out/vs/loader.js:4:1740)
at e.load (/snap/code/83/usr/share/code/resources/app/out/vs/loader.js:3:10695)
at d (/snap/code/83/usr/share/code/resources/app/out/vs/loader.js:5:10300)
at i._loadModule (/snap/code/83/usr/share/code/resources/app/out/vs/loader.js:5:10430)
at i._resolve (/snap/code/83/usr/share/code/resources/app/out/vs/loader.js:6:452)
at i.defineModule (/snap/code/83/usr/share/code/resources/app/out/vs/loader.js:5:6142)
at v (/snap/code/83/usr/share/code/resources/app/out/vs/loader.js:6:1702)
at g (/snap/code/83/usr/share/code/resources/app/out/vs/loader.js:4:2557)
at Object.<anonymous> (/snap/code/83/usr/share/code/resources/app/out/vs/code/node/cli.js:9:115415)
at Object.<anonymous> (/snap/code/83/usr/share/code/resources/app/out/vs/code/node/cli.js:12:18613)
at e._createAndEvalScript (/snap/code/83/usr/share/code/resources/app/out/vs/loader.js:4:2601)
at /snap/code/83/usr/share/code/resources/app/out/vs/loader.js:4:2240
at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3) {
errno: -5,
syscall: 'read',
code: 'EIO',
phase: 'loading',
moduleId: 'minimist',
neededBy: [ 'vs/platform/environment/node/argv' ]
}
Here are the modules that depend on it:
[ 'vs/platform/environment/node/argv' ]

Try to install the minimist npm package globally with
npm install -g minimist

Accidentally removed some packages. Solved via reinstalling VS Code.

Related

npm Node.js Error: No native build was found M2 MacBook

I got this error on my M2 MacBook, running a project, that worked on my old Intel MacBook. Do you have any idea what the problem is?
I am using bun but npm run dev (node 18) gives me the same error.
The exact same error occurred on other projects.
Package.json dependencies:
"devDependencies": {
"#types/three": "^0.143.1",
"parcel": "^2.7.0"
},
"dependencies": {
"three": "^0.143.0"
}
Console output for bun run dev:
$ parcel src/index.html --open
Error: No native build was found for platform=darwin arch=x64 runtime=node abi=108 uv=1 libc=glibc node=18.7.0
loaded from: /Users/frankmayer/Documents/Git/WorldArchitect/WebGLPreview/node_modules/lmdb and package: #lmdb/lmdb-darwin-x64
at load.path (/Users/frankmayer/Documents/Git/WorldArchitect/WebGLPreview/node_modules/node-gyp-build-optional-packages/index.js:64:9)
at Object.load [as default] (/Users/frankmayer/Documents/Git/WorldArchitect/WebGLPreview/node_modules/node-gyp-build-optional-packages/index.js:20:30)
at Object.<anonymous> (/Users/frankmayer/Documents/Git/WorldArchitect/WebGLPreview/node_modules/lmdb/dist/index.cjs:47:47)
at Module._compile (/Users/frankmayer/Documents/Git/WorldArchitect/WebGLPreview/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1174:10)
at Module.load (node:internal/modules/cjs/loader:998:32)
at Module._load (node:internal/modules/cjs/loader:839:12)
at Module.require (node:internal/modules/cjs/loader:1022:19)
at require (/Users/frankmayer/Documents/Git/WorldArchitect/WebGLPreview/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at _lmdb (/Users/frankmayer/Documents/Git/WorldArchitect/WebGLPreview/node_modules/#parcel/cache/lib/LMDBCache.js:61:39)
Script error "dev" exited with 1 status
Thanks in advance!
You can override a version using the override option in you package.json.
Read more about this option here: https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides
For me, the solution was to add this to my package.json:
"overrides": {
"lmdb": "2.6.0-alpha6",
"#lmdb/lmdb-darwin-arm64": "2.6.0-alpha6",
"#lmdb/lmdb-darwin-x64": "2.6.0-alpha6",
}
This feature is currently (Aug. 2022) not supported by bun!
Yarn does this using resolutions: https://classic.yarnpkg.com/lang/en/docs/selective-version-resolutions

cannot find module in node express

cannot find module in node express
Actual code
const express = require('express')
const app = express()
const port = 3000
app.get('/', (req, res) => {
res.send('Hello World!')
})
app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`)
})
error code in cmd
C:\Users\user\Desktop\project>npm express -v
7.5.3
C:\Users\user\Desktop\project>npm utils -v
7.5.3
C:\Users\user\Desktop\project>node server
node:internal/modules/cjs/loader:928
throw err;
^
Error: Cannot find module './utils'
Require stack:
- C:\Users\user\Desktop\project\node_modules\qs\lib\stringify.js
- C:\Users\user\Desktop\project\node_modules\qs\lib\index.js
- C:\Users\user\Desktop\project\node_modules\express\lib\middleware\query.js
- C:\Users\user\Desktop\project\node_modules\express\lib\application.js
- C:\Users\user\Desktop\project\node_modules\express\lib\express.js
- C:\Users\user\Desktop\project\node_modules\express\index.js
- C:\Users\user\Desktop\project\server.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Module.require (node:internal/modules/cjs/loader:997:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (C:\Users\user\Desktop\project\node_modules\qs\lib\stringify.js:3:13)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:973:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Module.require (node:internal/modules/cjs/loader:997:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\user\\Desktop\\project\\node_modules\\qs\\lib\\stringify.js',
'C:\\Users\\user\\Desktop\\project\\node_modules\\qs\\lib\\index.js',
'C:\\Users\\user\\Desktop\\project\\node_modules\\express\\lib\\middleware\\query.js',
'C:\\Users\\user\\Desktop\\project\\node_modules\\express\\lib\\application.js',
'C:\\Users\\user\\Desktop\\project\\node_modules\\express\\lib\\express.js',
'C:\\Users\\user\\Desktop\\project\\node_modules\\express\\index.js',
'C:\\Users\\user\\Desktop\\project\\server.js'
]
}
first try to remove the globally installed express
then initialize a package.json file with npm init. Here you will have a list of your dependencies, scripts and name of your package and some other data.
Then install express with npm i express.
after installing try to run it with node server.js or npm start if you have written the script to run the start command in package.json
I got the answer
Download utils https://www.npmjs.com/package/utils
this is the error
C:\Users\user\Desktop\project>
node server
node:internal/modules/cjs/loader:928
throw err;
^
Error: Cannot find module 'utils'
Require stack:
- C:\Users\user\Desktop\project\server.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Module.require (node:internal/modules/cjs/loader:997:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (C:\Users\user\Desktop\project\server.js:3:15)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:973:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'C:\\Users\\user\\Desktop\\project\\server.js' ]
}
C:\Users\user\Desktop\project>
npm i utils
added 43 packages, removed 2 packages, changed 3 packages, and audited 110 packages in 16s
found 0 vulnerabilities
C:\Users\user\Desktop\project>node server
Example app listening at http://localhost:3000
^C
C:\Users\user\Desktop\project>

node_modules error: missing module postcss, when is present in node_modules/.bin

I'm trying to run a package.json script (with yarn) however it seems to fail due to a missing module. However when checking node modules it seems the relevant module is there, so I'm not clear how to resolve the error.
~/P/j/tw-tutorial ❯❯❯ yarn build:css
yarn run v1.22.4
$ postcss src/css/tailwind.css -o src/css/main.css
internal/modules/cjs/loader.js:955
throw err;
^
Error: Cannot find module '../'
Require stack:
- /Users/yunti/Projects/js/tw-tutorial/node_modules/.bin/postcss
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:952:15)
at Function.Module._load (internal/modules/cjs/loader.js:835:27)
at Module.require (internal/modules/cjs/loader.js:1012:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/Users/yunti/Projects/js/tw-tutorial/node_modules/.bin/postcss:3:1)
at Module._compile (internal/modules/cjs/loader.js:1123:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
at Module.load (internal/modules/cjs/loader.js:972:32)
at Function.Module._load (internal/modules/cjs/loader.js:872:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/Users/yunti/Projects/js/tw-tutorial/node_modules/.bin/postcss' ]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
~/P/j/tw-tutorial ❯❯❯ postcss src/css/tailwind.css -o src/css/main.css
fish: Unknown command: postcss
~/P/j/tw-tutorial ❯❯❯ npx postcss src/css/tailwind.css -o src/css/main.css
Cannot find module '../'
Require stack:
- /Users/yunti/Projects/js/tw-tutorial/node_modules/.bin/postcss
~/P/j/tw-tutorial ❯❯❯ ll ./node_modules/.bin | grep postcss
-rwxr-xr-x 1 yunti staff 36B 24 Apr 10:20 postcss
update looks like the error is coming from postcss (not because postcss can't be found) as
postcss.config.js
module.exports = {
plugins:[
require('tailwindcss'),
require('autoprefixer'),
process.env.NODE_ENV === 'production' && require('#fullhuman/postcss-purgecss')({
content: [
'.src/**/*.js',
'.src/**/*.jsx',
'./public/index.html',
],
defaultExtractor: content=> content.match(/[A-Za-z0-9-_:/]+/g) || []
})
],
};

i have an error at nodejs with 'oracledb'

I have an error with oracledb modules.
I have successed to install oracledb.
when i typed like this,
-> npm install oracledb
njsOracle.cpp
njsPool.cpp
njsConnection.cpp
njsResultSet.cpp
njsMessages.cpp
njsIntLob.cpp
dpiEnv.cpp
dpiEnvImpl.cpp
dpiException.cpp
dpiExceptionImpl.cpp
dpiConnImpl.cpp
dpiDateTimeArrayImpl.cpp
dpiPoolImpl.cpp
dpiStmtImpl.cpp
dpiUtils.cpp
dpiLob.cpp
dpiCommon.cpp
win_delay_load_hook.cc
C:\Users\aaa\AppData\Roaming\npm\node_modules\oracledb\build\Release\oracledb.lib 라이브러리 및 C:\Users\aaa
\AppData\Roaming\npm\node_modules\oracledb\build\Release\oracledb.exp 개체를 생성하고 있습니다.
코드를 생성하고 있습니다.
코드를 생성했습니다.
oracledb.vcxproj -> C:\Users\aaa\AppData\Roaming\npm\node_modules\oracledb\build\Release\oracledb.node
oracledb.vcxproj -> C:\Users\aaa\AppData\Roaming\npm\node_modules\oracledb\build\Release\oracledb.pdb (Full PDB)
C:\Users\GwiTtaeGi\AppData\Roaming\npm
`-- oracledb#1.13.1
but when i execute require('oracledb'), there's an error like this.
Error: The specified procedure could not be found.
\?\c:\testnode\test\node_modules\oracledb\build\Release\oracledb.node
at Error (native)
at Object.Module._extensions..node (module.js:597:18)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (c:\testnode\test\node_modules\oracledb\lib\oracledb.js:35:19)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
I can't fix this error..
version is..
node -v : v6.10.3
npm -v : 4.5.0
Firstly, try to clean NPM cache
rm -rf ~/.node-gyp ~/.npm; npm cache clean
If error still occurs, try set NODE_PATH environment variable

How to run Jison tests with Node.js?

Trying to run Jison unit tests, but the command fails.
How do I fix that?
$ git clone git://github.com/zaach/jison.git
Cloning into 'jison'...
remote: Counting objects: 2667, done.
remote: Compressing objects: 100% (1106/1106), done.
remote: Total 2667 (delta 1523), reused 2644 (delta 1501)
Receiving objects: 100% (2667/2667), 731.51 KiB | 129 KiB/s, done.
Resolving deltas: 100% (1523/1523), done.
$ cd jison/
$ make test
node tests/all-tests.js
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'jison'
at Function._resolveFilename (module.js:332:11)
at Function._load (module.js:279:25)
at Module.require (module.js:354:17)
at new require (module.js:370:17)
at /private/tmp/jison/lib/jison/ebnf.js:43:18
at Object.<anonymous> (/private/tmp/jison/lib/jison/ebnf.js:150:2)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:31)
at Function._load (module.js:308:12)
make: *** [test] Error 1
Add an npm install before make test.
Commands I used to fix the error:
npm install
rm -rf node_modules/jison
ln -s ../ node_modules/jison
npm install downloads all dependencies into ./node_modules, but that includes a copy of jison.

Categories