Install expo cli errors at the end of install - node.js

So I'm following this tutorial to try and learn React Native: https://www.youtube.com/watch?v=qSRrxpdMpVc
And in the tutorial he shows to install expo cli using the line
'npm install expo-cli --global'
But when i run that line, i get a whole bunch of warnings saying for example:
npm WARN deprecated topo#3.0.3: This module has moved and is now available at #hapi/topo. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
In the tutorial he says to ignore this but at the end of the install i get this error:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! envsub#3.1.0 postinstall: `test -d .git && cp gitHookPrePush.sh .git/hooks/pre-push || true`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the envsub#3.1.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Alex\AppData\Roaming\npm-cache\_logs\2019-12-06T01_25_52_024Z-debug.log
and then when i try to run the line 'expo init first-app' to create a project i get this error:
Error: Cannot find module 'C:\Users\Alex\AppData\Roaming\npm\node_modules\expo-cli\bin\expo.js'
[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)[39m
[90m at Function.Module._load (internal/modules/cjs/loader.js:690:27)[39m
[90m at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)[39m
[90m at internal/main/run_main_module.js:17:11[39m {
code: [32m'MODULE_NOT_FOUND'[39m,
requireStack: []
}
I also found a similar question with an answer of try running
npm cache clean --force
npm install -g expo-cli
So i tried that but it didnt work.
Does anyone know why i would be getting these errors? I tried reinstalling node but that doesnt seem to fix it. Thanks for the help in advance, keep in mind i am completely new to react native

Assuming that you have Node 10 LTS or greater installed, you can use npm to install the Expo CLI command line utility:
npm install -g expo-cli
expo init AwesomeProject
cd AwesomeProject
npm start # you can also use: expo start

Related

Cannot find module typescript.js after Windows restoration point. I'm triying to build my angular app

I had problems with my PC and I restored windows to and old restoration point.
After this... When I try to build my Angular App I have the next error:
C:\Udemy\AngularDeCeroAExpertoEdicion2021\03-paisesApp>npm run build
> paises-app#0.0.0 build C:\Udemy\AngularDeCeroAExpertoEdicion2021\03-paisesApp
> npm run config -- --environment=prod && ng build --prod
> paises-app#0.0.0 config C:\Udemy\AngularDeCeroAExpertoEdicion2021\03-paisesApp
> ts-node ./src/assets/scripts/setEnv.ts "--environment=prod"
internal/modules/cjs/loader.js:329
throw err;
^
Error: Cannot find module 'C:\Udemy\AngularDeCeroAExpertoEdicion2021\03-paisesApp\node_modules\typescript\lib\typescript.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (internal/modules/cjs/loader.js:321:19)
at Function.Module._findPath (internal/modules/cjs/loader.js:534:18)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:888:27)
at Function.resolve (internal/modules/cjs/helpers.js:98:19)
at loadCompiler (C:\Users\myuser\AppData\Roaming\npm\node_modules\ts-node\dist\index.js:208:34)
at create (C:\Users\myuser\AppData\Roaming\npm\node_modules\ts-node\dist\index.js:213:28)
at Object.register (C:\Users\myuser\AppData\Roaming\npm\node_modules\ts-node\dist\index.js:184:21)
at main (C:\Users\myuser\AppData\Roaming\npm\node_modules\ts-node\dist\bin.js:129:29)
at Object.<anonymous> (C:\Users\myuser\AppData\Roaming\npm\node_modules\ts-node\dist\bin.js:448:5)
at Module._compile (internal/modules/cjs/loader.js:1085:14) {
code: 'MODULE_NOT_FOUND',
path: 'C:\\Udemy\\AngularDeCeroAExpertoEdicion2021\\03-paisesApp\\node_modules\\typescript\\package.json',
requestPath: 'typescript'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! paises-app#0.0.0 config: `ts-node ./src/assets/scripts/setEnv.ts "--environment=prod"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the paises-app#0.0.0 config script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\myuser\AppData\Roaming\npm-cache\_logs\2021-08-01T08_27_09_159Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! paises-app#0.0.0 build: `npm run config -- --environment=prod && ng build --prod`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the paises-app#0.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\myuser\AppData\Roaming\npm-cache\_logs\2021-08-01T08_27_09_186Z-debug.log
I think that the problem is with the directory:
C:\Users\myuser\AppData\Roaming\npm\node_modules\
What can I do?
remove the folder node_modules?
reinstall npm?
I tried with npm install and all is ok.
Thanks.
Edited:
Maybe the problem was in my merged branches or something like that.
Since you have not specified what was the installed state of apps when the restoration point was lastly set, I presume that you have all the npm packages captured correctly at that point. If so, try doing the below steps...
Since you have not included the entire log with this, I can guess it is possibly an ambiguity issue due to references not properly resolved!
Open command prompt/powershell/terminal, etc. with admin privilege. Do as below (sudo command not to be used with Windows OS): -
sudo npm cache clean --force
sudo npm cache verify
Delete the package-lock.json file located at C:\Users\<your_username>
Try installing your project dependencies now from your project folder with npm i or yarn install (if you're using yarn as your preferred package manager).
Note: - If this doesn't work, follow the same process as above (again) and uninstall npm/yarn and node and reinstall it. It should work then!
I have fixed it by doing the following:
Remove the folder /node_modules of my Angular App.
Run npm install.
And then run npm run build or npm run start or ng serve.
I have also found a package that does the same. The package name is reinstall
reinstall
Reinstall package's node modules without cache.
Removes node_modules directory
Clean's NPM cache
Install's modules from package.json
npm install reinstall -g
Once installed remember restart your terminal and run reinstall in your root dir.
Maybe the problem was in my merged branches or something like that.

Trying Laravel jetstream but getting an error on "npm run dev"

lam getting the error below while running npm run dev
[webpack-cli] TypeError: this.program.configureOutput is not a function
at new WebpackCLI (/home/vagrant/sites/ecom/node_modules/webpack-cli/lib/webpack-cli.js:19:22)
at runCLI (/home/vagrant/sites/ecom/node_modules/webpack-cli/lib/bootstrap.js:7:21)
at Object. (/home/vagrant/sites/ecom/node_modules/webpack-cli/bin/cli.js:23:5)
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)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Module.require (node:internal/modules/cjs/loader:996:19)
at require (node:internal/modules/cjs/helpers:92:18)
at runCli (/home/vagrant/sites/ecom/node_modules/webpack/bin/webpack.js:54:2)
npm ERR! code 2
npm ERR! path /home/vagrant/sites/ecom
npm ERR! command failed
npm ERR! command sh -c mix
npm ERR! A complete log of this run can be found in:
npm ERR! /home/vagrant/.npm/_logs/2021-03-19T11_14_07_947Z-debug.log
npm ERR! code 2
npm ERR! path /home/vagrant/sites/ecom
npm ERR! command failed
npm ERR! command sh -c npm run development
npm ERR! A complete log of this run can be found in:
npm ERR! /home/vagrant/.npm/_logs/2021-03-19T11_14_07_974Z-debug.log
First, try to update your node.js file and then run "npm run dev" and if you again faced the same problem follow the following steps:
Step1: composer update
Step2: rm -rf node_modules
Step3: npm cache clear --force
Step4: npm install
Step5: npm outdated
In this step, it will update your laravel-mix version, it is in the package.json.
Step6: npm install
Step7: npm run dev
After all these steps, everything is good.
I hope it solve your problem.
I came across this problem when trying to build and run webpack (and webpack-cli locally), after check out from Github (not at all related to Laravel).
I found that I forgot to run yarn install for webpack-cli which lead to the issue that an existing version of commander#6 was used, but webpack-cli requires commander#7.
npm list commander should tell you that the webpack-cli dependency is unsatisfied. yarn install should fix it.

Can't install 'node-sass' on Ubuntu 20

I use webpack 4, sass, pug and bemto. Module on windows worked normal, but on Ubuntu:
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! node-sass#4.14.1 postinstall: `node scripts/build.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the node-sass#4.14.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I tried enter command:
sudo npm install -g --unsafe-perm node-sass
>
(node:8310) [DEP0139] DeprecationWarning: Calling process.umask() with no arguments is prone to race conditions and is a potential security vulnerability.
(Use `node --trace-deprecation ...` to show where the warning was created)
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
/usr/local/bin/node-sass -> /usr/local/lib/node_modules/node-sass/bin/node-sass
npm WARN lifecycle The node binary used for scripts is /snap/bin/node but npm is using /snap/node/2725/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
> node-sass#4.14.1 install /usr/local/lib/node_modules/node-sass
> node scripts/install.js
Cached binary found at /root/.npm/node-sass/4.14.1/linux-x64-83_binding.node
> node-sass#4.14.1 postinstall /usr/local/lib/node_modules/node-sass
> node scripts/build.js
Binary found at /usr/local/lib/node_modules/node-sass/vendor/linux-x64-83/binding.node
Testing binary
/snap/node/2725/bin/node: symbol lookup error: /usr/local/lib/node_modules/node-sass/vendor/linux-x64-83/binding.node: undefined symbol: _ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeEPKNS_9CFunctionE
npm WARN You are using a pre-release version of node and things may not work as expected
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! node-sass#4.14.1 postinstall: `node scripts/build.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the node-sass#4.14.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
UPD:
I tried:
npm uninstall node-sass
After:
npm install node-sass
Did not help.
I tried:
npm install node-gyp global, save, savedev
ERROR in ./src/sсss/critical.scss (./node_modules/css-loader??ref--5-1!./node_modules/sass-loader/lib/loader.js??ref--5-2!./src/sсss/critical.scss)
Module build failed (from ./node_modules/sass-loader/lib/loader.js):
Error: Cannot find module 'node-sass'
Require stack:
- /home/gorevanova/Documents/WebStorm/webpack-static/node_modules/sass-loader/lib/loader.js
- /home/gorevanova/Documents/WebStorm/webpack-static/node_modules/loader-runner/lib/loadLoader.js
- /home/gorevanova/Documents/WebStorm/webpack-static/node_modules/loader-runner/lib/LoaderRunner.js
- /home/gorevanova/Documents/WebStorm/webpack-static/node_modules/webpack/lib/NormalModule.js
- /home/gorevanova/Documents/WebStorm/webpack-static/node_modules/webpack/lib/NormalModuleFactory.js
- /home/gorevanova/Documents/WebStorm/webpack-static/node_modules/webpack/lib/Compiler.js
- /home/gorevanova/Documents/WebStorm/webpack-static/node_modules/webpack/lib/webpack.js
- /home/gorevanova/Documents/WebStorm/webpack-static/node_modules/webpack-dev-server/bin/webpack-dev-server.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1020:15)
at Function.Module._load (internal/modules/cjs/loader.js:890:27)
at Module.require (internal/modules/cjs/loader.js:1080:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/home/gorevanova/Documents/WebStorm/webpack-static/node_modules/sass-loader/lib/loader.js:3:14)
at Module._compile (internal/modules/cjs/loader.js:1176:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1196:10)
at Module.load (internal/modules/cjs/loader.js:1040:32)
at Function.Module._load (internal/modules/cjs/loader.js:929:14)
at Module.require (internal/modules/cjs/loader.js:1080:19)
at require (internal/modules/cjs/helpers.js:72:18)
at loadLoader (/home/gorevanova/Documents/WebStorm/webpack-static/node_modules/loader-runner/lib/loadLoader.js:18:17)
at iteratePitchingLoaders (/home/gorevanova/Documents/WebStorm/webpack-static/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
at iteratePitchingLoaders (/home/gorevanova/Documents/WebStorm/webpack-static/node_modules/loader-runner/lib/LoaderRunner.js:165:10)
at /home/gorevanova/Documents/WebStorm/webpack-static/node_modules/loader-runner/lib/LoaderRunner.js:176:18
at loadLoader (/home/gorevanova/Documents/WebStorm/webpack-static/node_modules/loader-runner/lib/loadLoader.js:47:3)
But problem don't leave me.
Run this commands:
rm -rf ./node_modules ./package-lock.json, then
npm cache verify.
PS: I recommend to install nvm
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
Also I don’t know if you already have it, but make sure to also have build-essential install
$ sudo apt update && apt install build-essential
It is a set of c++ compilers and Bunch of useful 💩
something else that I have seen is the lack of python 2.x.x
$ sudo apt install python
Try this, it worked for me
npm i --unsafe-perm node-sass
Please check your node version before install it, node-sass has striction about node versions, shown as below:
refer to https://github.com/sass/node-sass
Cached binary found at /root/.npm/node-sass/4.14.1/linux-x64-83_binding.node
Binary found at /usr/local/lib/node_modules/node-sass/vendor/linux-x64-83/binding.node
Testing binary
I would say the issue could be the fact it's using a cached version from before you upgraded to Ubuntu 20, in which case, removing the cached binary would resolve this.
https://docs.npmjs.com/cli-commands/cache.html
This is just my assumption, what have you tried so far to resolve this issue?

Failed at the #angular/cli#8.3.19 postinstall script

Hi I can't install the angular cli with npm install -g #angular/cli#8.3.19.
I keep getting this :
> node ./bin/postinstall/script.js
module.js:549
throw err;
^
Error: Cannot find module '/root/.nvm/versions/node/v13.0.1/lib/node_modules/#angular/cli/bin/postinstall/script.js'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! #angular/cli#8.3.19 postinstall: `node ./bin/postinstall/script.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the #angular/cli#8.3.19 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-11-26T00_10_33_515Z-debug.log
Node version : 13.0.1
Npm version : 6.13.1
Ubuntu version : 18.04.2
I also tried without specifying a CLI version.
I tried with this command that I found online :
npm install -g #angular/cli#8.3 --unsafe-perm=true --allow-root
And it worked.
Try to run with sudo npm. On Ubuntu, you need to run with root permission. It depends on how you install node.
sudo npm install -g #angular/cli#8.3.19
On the other hand, try to install node 12 and LTS versions to have a more secure version.
Hope it helps
Try clean your npm cache before npm cache clean or npm cache verify then npm install -g #angular/cli#8.3 --unsafe-perm=true --allow-root
Steps I followed
Downgrade node version using nvm to v12.3.0
Remove ng folder from /root/.nvm/versions/node/v12.3.0/bin
Again do npm install -g #angular/cli#8.3 --unsafe-perm=true --allow-root
and it worked

Can't install any Node packages globally Ubuntu Digital Ocean

Tried everything. Tried all the steps below, didn't work so I nuked my droplet and rebuilt to start over and try again. I'm Using Ubuntu. First thing once I ssh into my droplet was install node and npm via:
https://nodejs.org/en/download/package-manager/
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
Then
npm -v
5.6.0
node -v
v8.11.3
Then I try to install a package globally. I tried electron and it failed so I began messing with the node modules folder as I was getting the permission error with the fix documented here:
https://askubuntu.com/questions/869168/node-modules-have-755-permissions-what-permissions-should-i-set-so-that-npm-don
No luck. So I tried the solution documented here:
NPM global install "cannot find module"
echo $NODE_PATH
/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript:/home/username/.npm-global/lib/node_modules
So that didn't work either. This is the error now when I try and install any package globally:
npm install -g electron
I get:
Error: Cannot find module '/root/.npm-global/lib/node_modules/nightmare/node_modules/electron/install.js'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron#1.8.7 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron#1.8.7 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-08-03T03_26_03_827Z-debug.log
This error for any package I try to install. Not sure what else to try. Don't want to wipe out the droplet and start over...
I also had this issue but after adding sudo at start the issue went away.
like:
sudo npm -g install nodemon

Resources