Installing node-sass fails on Ubuntu 18.04 - node.js

I have a simple next.js project, which I created following their tutorial. It builds and runs well on my Windows development machine.
I want to deploy it on Ubuntu 18.04.02 LTS but when I clone the git project and run npm install it fails to install node-sass with the following error message:
> node-sass#4.12.0 install /var/www/example.com/beta/node_modules/node-sass
> node scripts/install.js
internal/modules/cjs/loader.js:584
throw err;
^
Error: Cannot find module '/var/www/example.com/beta/node_modules/node-sass/scripts/install.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass#4.12.0 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass#4.12.0 install 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: ...
Here is a gist of the log file. See the last few lines for the error (I have included the whole file in case there is other information that is useful).
My NodeJS version is 10.15.3 and my NPM version is 6.4.1. I am not sure how to run next.js project on Ubuntu.

Apparently, I needed to install it with --unsafe-perms flag:
npm install --unsafe-perms
No explanation onto why it needs this and the unsafe word is not recommended by many.
In addition, the folder permissions needed to be in such a way that the script can create folders. I had to create a folder as me, clone the repo there, run the npm install --unsafe-perms, and then set the permissions as of a production web server.
For reference see here.

Try installing it manually, prior to installing all of the other packages - there might be some package dependency issue.
npm install node-sass#4.12.0 && npm install

This module has striction about node versions, as below:
solution is: specify the module version when you install it.
P.S. Other approach:
if you just want to use scss/sass, use this module:
npm install sass sass-loader
this does NOT work for: node 16, ubuntu 18
npm install --unsafe-perms
for node 14, ubuntu 18 , I can install it:
npm install node-sass

Related

After Upgrading my npm from version 6 to version 7 (node version was 10) I cant install dependencies for some projects

I had node version 10 installed in my system, after upgrading my npm from version 6 to version 7 I couldn't install the dependencies, and I'm getting error so I had to downgrade my node to 6,
(both npm ci and npm i was failing)
And the project I was testing is this:
https://github.com/Giveth/feathers-giveth
the errors were something like this:
npm ERR! code 128
npm ERR! git dep preparation failed
npm ERR! command /Users/username/.nvm/versions/node/v10.23.0/bin/node /Users/username/.nvm/versions/node/v10.23.0/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/Users/username/.npm/_cacache --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm ERR! code 128
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command git clone --mirror -q ssh://git#github.com/gulpjs/gulp.git /Users/renjer/.npm/_cacache/_cacache/tmp/git-clone-dfb83c15/.git
npm ERR! npm ERR! fatal: destination path '/Users/username/.npm/_cacache/_cacache/tmp/git-clone-dfb83c15/.git' already exists and is not an empty directory.
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR! /Users/username/.npm/_cacache/_logs/2021-02-18T16_18_35_855Z-debug.log
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/username/.npm/_logs/2021-02-18T16_20_15_536Z-debug.log
This problem usually happen because if you only upgrade the node version of the system, there are some packages and dependencies that are installed according to that version.
This is a manual process, but you have to install the package according that version.
For example (package.json):
In your node 6 version you have some package:
"xyz":^1.2.3
that package was installed and its dependencies to work with node 6
delete manually that package from your package.json and install it manually like
npm install xyz
Then is possible that you notice an upgrade to the version, something like:
"xyz":^4.5.6
Do that for everyone of your packages and probably your problem disappears. That's the way that I have used to solve that problem.
You can also upgrade all the packages to its lasts version but ... if you have many packages and someone is not working you are not going to know which one is failing, and you are going to check it individually.
Maybe (at the moment of writing this answer) if you are using Node 10, the latest package's version is not going to work either because that version could be fixed to work with Node 16 (the LTS (Long term support) version at the moment of writing this answer).
If you haven't done that yet, I suggest to continually upgrade your system to the some LTS version that isn't deprecated.

Install expo cli errors at the end of install

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

error pngquant-bin with npm install

I installing npm and all works until this error, I am trying to discover what its causing this problem but no success. After the installation I tried to run 'npm run dev' but with errors too. I guess because the problem with the npm install at all. I tried to install the module pngquant-bin but no success too.
If you know a way or you face this same problem already, please help me. I see the other questions about it but with any responses. Please.
pngquant-bin#4.0.0 postinstall /var/www/html/futebit/node_modules/pngquant-bin
node lib/install.js
⚠ The `/var/www/html/futebit/node_modules/pngquant-bin/vendor/pngquant` binary doesn't seem to work correctly
⚠ pngquant pre-build test failed
ℹ compiling from source
✔ pngquant pre-build test passed successfully
✖ Error: pngquant failed to build, make sure that libpng-dev is installed
at Promise.all.then.arr (/var/www/html/futebit/node_modules/pngquant-bin/node_modules/bin-build/node_modules/execa/index.js:231:11)
at process._tickCallback (internal/process/next_tick.js:68:7)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! pngquant-bin#4.0.0 postinstall: `node lib/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pngquant-bin#4.0.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! /root/.npm/_logs/2018-07-16T14_17_27_195Z-debug.log
Pngquant require vcruntime140.dll.
Download and install 64bit and 32bit Visual C++ Redistributable for Visual Studio 2015 from https://www.microsoft.com/en-in/download/details.aspx?id=48145
The error states make sure that libpng-dev is installed. That means that you are probably missing that package.
On Debian/Ubuntu you can fix it with sudo apt install libpng-dev. That worked for me.
It seems you are trying to use the precompiled binary pngquant-bin and it fails because of incompatible libraries used in the OS, so two ways to use them:
Install system-wide pngquant package apart the node package
If you are using an old OS try upgrade the libraries then install the node package again
In case you have the newest OS, try upgrade the node package to the newest version too.

Throwing error while executing npm install marialsql

I would need your help in resolving below error.
I am trying to build an angular project with mariasql as it is the backend db
In order to do that: I tried following steps
Step-1: I installed windows production tool with following command
line as maria db requires Microsoft Visual studio compiler
`"npm install --global windows-build-tools"`
After step-1, I have got visual studio and python 2.7 in my laptop when i installed the global windows build tools
Step-2: I set PYTHON Environment variable in my system
Step 3: I created a brand new angular project like below
ng new selenium-package
The project got created with node_modules
Step 4: I tried installing marialsql as below
npm install mariasql
With this, I am getting below error:
C:\Users\Jack\Documents\Tuitorial\Exercise\selenium-package\node_modules\mariasql> if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "node C:\Users\Jack\Documents\Tuitorial\Exercise\selenium-automation-builder\node_modules\node-gyp\bin\node-gyp.js" rebuild ) module.js:557
throw err;
^
Error: Cannot find module 'C:\Users\Jack\Documents\Tuitorial\Exercise\selenium-package\node_modules\mariasql\node C:\Users\Jack\Documents\Tuitorial\Exercise\selenium-automation-builder\node_modules\node-gyp\bin\node-gyp.js'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Function.Module.runMain (module.js:701:10)
at startup (bootstrap_node.js:194:16)
at bootstrap_node.js:618:3 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.3 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! mariasql#0.2.6 install: `node-gyp rebuild` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the mariasql#0.2.6 install 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\Jack\AppData\Roaming\npm-cache\_logs\2017-12-22T04_49_00_804Z-debug.log

Node.js Appium install fail

I tried to install Appium with command: npm install -g appium#1.6.4-beta
I am behind corporate proxy. So i set new proxy with:
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
also i tried:
--ignore_ssl or --proxy http://10.165.42.170:8080
My soft:
Node.js: v4.6.0
node-gyp -v v3.4.0
npm v4.4.4
Windows 8.1
But i am getting this error in install:
C:\Project\taf>npm install -g appium#1.6.4-beta
npm WARN deprecated babel-core#5.8.24: Babel 5 is no longer being maintained. Up
grade to Babel 6.
npm WARN deprecated minimatch#2.0.10: Please update to minimatch 3.0.2 or higher
to avoid a RegExp DoS issue
npm WARN deprecated line-numbers#0.2.0: Copy its ~20 LOC directly into your code
instead.
C:\Users\JE11954\AppData\Roaming\npm\appium -> C:\Users\JE11954\AppData\Roaming\
npm\node_modules\appium\build\lib\main.js
> appium-chromedriver#2.11.0 install C:\Users\JE11954\AppData\Roaming\npm\node_m
odules\appium\node_modules\appium-chromedriver
> node install-npm.js
info Chromedriver Install Installing Chromedriver version '2.28' for platform 'w
in' and architecture '32'
info Chromedriver Install Opening temp file to write chromedriver_win32 to...
info Chromedriver Install Downloading https://chromedriver.storage.googleapis.co
m/2.28/chromedriver_win32.zip...
RequestError: Error: connect ETIMEDOUT 172.217.23.208:443
at new RequestError (C:\Users\JE11954\AppData\Roaming\npm\node_modules\appiu
m\node_modules\request-promise\lib\errors.js:11:15)
at Request.RP$callback [as _callback] (C:\Users\JE11954\AppData\Roaming\npm\
node_modules\appium\node_modules\request-promise\lib\rp.js:60:32)
at self.callback (C:\Users\JE11954\AppData\Roaming\npm\node_modules\appium\n
ode_modules\request\request.js:188:22)
at emitOne (events.js:77:13)
at Request.emit (events.js:169:7)
at Request.onRequestError (C:\Users\JE11954\AppData\Roaming\npm\node_modules
\appium\node_modules\request\request.js:884:8)
at emitOne (events.js:77:13)
at ClientRequest.emit (events.js:169:7)
at TLSSocket.socketErrorListener (_http_client.js:269:9)
at emitOne (events.js:77:13)
at TLSSocket.emit (events.js:169:7)
at emitErrorNT (net.js:1269:8)
at nextTickCallbackWith2Args (node.js:442:9)
at process._tickCallback (node.js:356:17)
C:\Users\JE11954\AppData\Roaming\npm
`-- (empty)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.x (node_modules\appiu
m\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#
1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! appium-chromedriver#2.11.0 install: `node install-npm.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the appium-chromedriver#2.11.0 install script 'node install-n
pm.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the appium-chromedriver p
ackage,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install-npm.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs appium-chromedriver
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls appium-chromedriver
npm ERR! There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\JE11954\AppData\Roaming\npm-cache\_logs\2017-04-04T12_46_5
6_785Z-debug.log
Updating Node / npm solved install issues for me.
I don't know what is causing this error.I have struggled a lot to resolve this by installing different node version and npm versions etc. but no success.
I have installed appium through yarn as below steps:
Download yarn.exe file from https://github.com/yarnpkg/yarn/releases
Run that .exe file and install as per instructions.
Once installation is finished, Add bin folder of yarn installation to your
PATH
i.e (In my machine : "C:\Program Files (x86)\Yarn\bin\")
Now run the below command :
yarn global add appium
This will install appium in your machine.
If this also doesn't work one more suggestion i can give is as below:
In general if you install appium through npm or yarn what it will do is it will install all the packages that will come along with appium latest GUI version i.e appium 1.7.2 which means whatever the packages are getting installed through npm or yarn will also come along with GUI version of appium which is appium-desktop.Please follow the below instructions:
Install latest appium-desktop version from the link : https://github.com/appium/appium-desktop/releases/tag/v1.4.1
Now go to installation path of appium-desktop.In my machine below is the path :
C:\Users\pawan.lingutla\AppData\Local\Programs\appium-
desktop\resources\app\node_modules\appium
In this folder you will find all the packages that will come with npm installation of appium.
This is a workaround when you face issues while installing appium into node_modules via npm or yarn.

Resources