Visual Studio Code extension generator not working - npm

I'm following the "Your first extension" visual studio code guide, and after installing yo and generator-code with npm and running yo code I get this error
C:\Users\[My Name]\AppData\Roaming\npm\node_modules\yo\node_modules\execa\index.js:347
throw err;
^
Error: Command failed: powershell (Get-CimInstance -ClassName Win32_OperatingSystem).caption
The term 'Get-CimInstance' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling
of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:17
+ (Get-CimInstance <<<< -ClassName Win32_OperatingSystem).caption
+ CategoryInfo : ObjectNotFound: (Get-CimInstance:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
at makeError (C:\Users\[My Name]\AppData\Roaming\npm\node_modules\yo\node_modules\execa\index.js:174:9)
at Function.module.exports.sync (C:\Users\[My Name]\AppData\Roaming\npm\node_modules\yo\node_modules\execa\index.js:338:15)
at windowsRelease (C:\Users\[My Name]\AppData\Roaming\npm\node_modules\yo\node_modules\windows-release\index.js:39:19)
at osName (C:\Users\[My Name]\AppData\Roaming\npm\node_modules\yo\node_modules\os-name\index.js:39:18)
at new Insight (C:\Users\[My Name]\AppData\Roaming\npm\node_modules\yo\node_modules\insight\lib\index.js:37:13)
at Object.<anonymous> (C:\Users\[My Name]\AppData\Roaming\npm\node_modules\yo\lib\cli.js:54:17)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
I really have no idea what to do so any help would be appriciated

Solved by updating from PowerShell v1.0 to PowerShell v5.1

Related

npm --prefix <dependency path> run <lifecycle scripts> (preinstall/install/postinstall/preprepare/prepare/postprepare) fails

I am trying to manually run lifecycle scripts of node_module dependencies for a project with npm --prefix <path> run <lifecycle script> after running npm -w <workspaces> ci --ignore-scripts.
I am attaching a part of log outputs of the scripts I wrote below.
...
Running prepare in node_modules/node-fetch
sh: 1: cross-env: not found
sh: 1: cross-env: not found
Running prepare in node_modules/#graphql-eslint/eslint-plugin/node_modules/cross-fetch
sh: 1: husky: not found
sh: 1: husky: not found
Running prepare in node_modules/sync-fetch
sh: 1: browserify: not found
sh: 1: browserify: not found
Running prepare in node_modules/#iarna/toml
> #iarna/toml#2.2.5 prepare
> npm run setup-burntsushi-toml-suite && npm run setup-iarna-toml-suite
> #iarna/toml#2.2.5 setup-burntsushi-toml-suite
> [ -d test/burntsushi-toml-test ] || (git clone https://github.com/BurntSushi/toml-test test/burntsushi-toml-test; rimraf test/burntsushi-toml-test/.git/hooks/*); cd test/burntsushi-toml-test; git pull
Already up to date.
> #iarna/toml#2.2.5 setup-iarna-toml-suite
> [ -d test/spec-test ] || (git clone https://github.com/iarna/toml-spec-tests -b 0.5.0 test/spec-test; rimraf test/spec-test/.git/hooks/*); cd test/spec-test; git pull
Already up to date.
Running prepare in node_modules/camel-case
Running prepare in node_modules/pascal-case
Running prepare in node_modules/yargs
Running prepare in node_modules/lower-case
Running prepare in node_modules/no-case
Running prepare in node_modules/#graphql-tools/utils/node_modules/camel-case
Running prepare in node_modules/send/node_modules/mime
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'mime-score'
Require stack:
- <path to the project>/node_modules/send/node_modules/mime/src/build.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (<path to the project>/node_modules/send/node_modules/mime/src/build.js:7:19)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'<path to the project>/node_modules/send/node_modules/mime/src/build.js'
]
}
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'mime-score'
Require stack:
- <path to the project>/node_modules/send/node_modules/mime/src/build.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (<path to the project>/node_modules/send/node_modules/mime/src/build.js:7:19)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'<path to the project>/node_modules/send/node_modules/mime/src/build.js'
]
}
...
Running prepare in /node_modules/#storybook/addon-actions
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module '<path to the project>/node_modules/scripts/prepare.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module '<path to the project>/node_modules/scripts/prepare.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
...
Based on the log, it seems like npm --prefix <path> run <lifecycle script> is often trying to run scripts that does not exist or use commands not installed, and thus fails.
Since some lifecycle scripts removes some codes and tries to rebuild them, I am also failing to build services in my root project.
I was suspecting this might be because
npm ci uses hoisting
dependencies have outdated lifecycle scripts in their package.json's
but after thinking, I don't think neither would be the case and this shouldn't be happening, because npm runs lifecycle scripts after npm ci in the background, and I was able to build services successfully when I used npm -w <workspaces> ci

* What went wrong: A problem occurred evaluating script

I'm trying to run a new React native project on an Android emulator and i get this error
FAILURE: Build failed with an exception.
Where:
Script '...\AwesomeProject\node_modules#react-native-community\cli-platform-android\native_modules.gradle' line: 213
What went wrong:
A problem occurred evaluating script.
internal/modules/cjs/loader.js:905 throw err; ^Error: Cannot find module '...\AwesomeProject\node_modules\react-native\node_modules#react-native-community\cli\build\bin.js' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15) at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) at internal/main/run_main_module.js:17:47 { code: 'MODULE_NOT_FOUND', requireStack: []}
please someone help, i trying to fix that for a long time.

Unable to start new project generated by express-generator. Error: ENOENT: no such file or directory

So I created a git repo -> npm init -> running express-generator getting this error
well it's something related to the sass I guess
$end:DEBUG='src:*'; npm start
ObjectNotFound: Cannot find drive. A drive with the name 'end' does not exist.
> src#0.0.0 start
> node ./bin/www
internal/fs/utils.js:307
throw err;
^
Error: ENOENT: no such file or directory, scandir 'C:\Users\MegaMind\Projects\inventoryInExpress\src\node_modules\node-sass\vendor'
at Object.readdirSync (fs.js:1021:3)
at Object.getInstalledBinaries (C:\Users\MegaMind\Projects\inventoryInExpress\src\node_modules\node-sass\lib\extensions.js:133:13)
at foundBinariesList (C:\Users\MegaMind\Projects\inventoryInExpress\src\node_modules\node-sass\lib\errors.js:20:15)
at foundBinaries (C:\Users\MegaMind\Projects\inventoryInExpress\src\node_modules\node-sass\lib\errors.js:15:5)
at Object.module.exports.missingBinary (C:\Users\MegaMind\Projects\inventoryInExpress\src\node_modules\node-sass\lib\errors.js:45:5)
at module.exports (C:\Users\MegaMind\Projects\inventoryInExpress\src\node_modules\node-sass\lib\binding.js:15:30)
at Object.<anonymous> (C:\Users\MegaMind\Projects\inventoryInExpress\src\node_modules\node-sass\lib\index.js:14:35)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32) {
errno: -4058,
syscall: 'scandir',
code: 'ENOENT',
path: 'C:\\Users\\MegaMind\\Projects\\inventoryInExpress\\src\\node_modules\\node-sass\\vendor'
}

Error in React Native with RealmJS- Command PhaseScriptExecution failed with a nonzero exit code

Using Node.js v12.13.0 internal/modules/cjs/loader.js:797
throw err;
^
Error: Cannot find module '/Users/ABC/Projects/ReactNative/Project ABCD'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
at Function.Module._load (internal/modules/cjs/loader.js:687:27)
at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
at internal/main/run_main_module.js:17:11 { code: 'MODULE_NOT_FOUND', requireStack: [] }
Command PhaseScriptExecution failed with a nonzero exit code
It seems like you are trying to reference a module that lives somewhere else. Can we see project code and file structure?
I resolved this issue by just removing a space from project folder name.
'Project ABCD' -> 'Project_ABCD'

whwn i start run expo i get Error: GetEnv.NoBoolean: ture is not a boolean

$ expo start
C:\Users\Amoory\AppData\Roaming\npm\node_modules\expo-cli\node_modules\getenv\lib\getenv.js:66
throw new Error('GetEnv.NoBoolean: ' + value + ' is not a boolean.');
^
Error: GetEnv.NoBoolean: ture is not a boolean.
at Object.boolish (C:\Users\Amoory\AppData\Roaming\npm\node_modules\expo-cli\node_modules\getenv\lib\getenv.js:66:15)
at Function.boolish (C:\Users\Amoory\AppData\Roaming\npm\node_modules\expo-cli\node_modules\getenv\lib\getenv.js:79:27)
at Object.<anonymous> (C:\Users\Amoory\AppData\Roaming\npm\node_modules\expo-cli\bin\expo.js:17:14)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
at internal/main/run_main_module.js:17:11
error Command failed with exit code 1.
info
Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
C:\Users\Amoory\Desktop\omar-1>
You need to change ture to true in your environment variables which are loaded using GetEnv