Puppetter fails due to node modules error - node.js

I am new to puppeteer and would appreciate as much help as possible.
My puppeteer tests build fails in travis ci. I am assuming the reason may be related to puppeteer's node_module. Any suggestion would be helpful.
There have been similar issues logged but with no solution provided. Here are some links of these issues:
https://github.com/GoogleChrome/puppeteer/issues/833
https://api.travis-ci.com/v3/job/124937719/log.txt
https://travis-ci.com/BME-MIT-IET/Hmmm-iet-2018/jobs/124938746
My system config:
Puppeteer version:1.8.0
Platform / OS version: Mac > High Sierra
Node.js version: v8.12.0
npm : 6.4.1
This is the error message:
puppeteer#1.8.0 install /www/vhosts//node_modules/puppeteer
node install.js
/www/vhosts/node_modules/puppeteer/install.js:61
.then(() => browserFetcher.localRevisions())
^
SyntaxError: Unexpected token )
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:935:3
npm ERR! puppeteer#1.8.0 install: node install.js
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the puppeteer#1.8.0 install script 'node install.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 puppeteer package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs puppeteer
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls puppeteer
npm ERR! There is likely additional logging output above.

From the Puppeteer documentation:
Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.
Your Travis configuration uses node v0.10.42 so you must upgrade it to atleast v6.4.0.
You can reference to Travis documentation on Specifying Node.js versions. Here is a minimal setup:
.travis.yml:
language: node_js
node_js:
- "iojs"
- "7"

Related

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?

Deploying a meteor 1.2 app to Ubuntu 16.04

I have an app that is still at meteor 1.2 that I used to deploy to ubuntu 14.04 servers happily with mup. However, I have now moved the host server along to 16.04 and mup (as well as mupc) have stopped working.
The last time I deployed one of these apps I followed the procedure below and it worked fine.
apt install nodejs nodejs-legacy
install nvm
nvm install v0.10.40
Bundle the app on my dev box, and unpack it on the host
cd /app/programs/server
npm install
and I get
> fibers#1.0.5 install /opt/sapwfdashboard/programs/server/node_modules/fibers
> node ./build.js
(node) child_process: options.customFds option is deprecated. Use options.stdio instead.
internal/child_process.js:298
throw errnoException(err, 'spawn');
^
Error: spawn EACCES
at exports._errnoException (util.js:870:11)
at ChildProcess.spawn (internal/child_process.js:298:11)
at Object.exports.spawn (child_process.js:362:9)
at build (/opt/sapwfdashboard/programs/server/node_modules/fibers/build.js:55:5)
at Object.<anonymous> (/opt/sapwfdashboard/programs/server/node_modules/fibers/build.js:47:3)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:442:10)
npm ERR! fibers#1.0.5 install: `node ./build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fibers#1.0.5 install script.
npm ERR! This is most likely a problem with the fibers package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./build.js
npm ERR! You can get their info via:
npm ERR! npm owner ls fibers
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 4.4.0-109-generic
npm ERR! command "/root/.nvm/v0.10.40/bin/node" "/root/.nvm/v0.10.40/bin/npm" "install"
npm ERR! cwd /opt/sapwfdashboard/programs/server
npm ERR! node -v v0.10.40
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0
I'm stuck. Any idea how to get around this. I am going to have to upgrade this app as the initial deployments are just impossible now.
The best way I've found to deploy this is to use mupc to set up the instances, and then use the manual deployment process from there onwards.
I'm still to work out what the differences are.

Google Firebase functions ImageMagick thumbnail creation failing

I am working on google firebase functions to generate thumbnails for images using imagemagic, I did exactly what is mentioned in this link
and also I have gone through this link.
I am getting the following exception while deploying using gcloud app deploy command. I have gone through other SO posts(link) which are similar to this issue.
I also have updated firebase tools using (npm install -g firebase-tools). is anything else I am missing ?
In the exception is says
at Object. (/app/lib/functions.js:43:47) at line number 43 the code snippet looks like this
exports.generateThumbnail = functions.storage.object().onChange(event => {
Exception looks as follows
Updating service [default]...failed.
ERROR: (gcloud.app.deploy) Error Response: [9]
Application startup error:
> nodejs-getting-started#1.0.0 start /app
> node app.js
/app/node_modules/firebase-functions/lib/config.js:51
throw new Error('Firebase config variables are not available. ' +
^
Error: Firebase config variables are not available. Please use the latest version of the Firebase CLI to deploy this function.
at init (/app/node_modules/firebase-functions/lib/config.js:51:15)
at Object.config (/app/node_modules/firebase-functions/lib/config.js:29:9)
at Object.object (/app/node_modules/firebase-functions/lib/providers/storage.js:41:27)
at Object.<anonymous> (/app/lib/functions.js:43:47)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
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)
npm ERR! Linux 3.16.0-4-amd64
npm ERR! argv "/nodejs/bin/node" "/nodejs/bin/npm" "start"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! nodejs-getting-started#1.0.0 start: `node app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nodejs-getting-started#1.0.0 start script 'node app.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 nodejs-getting-started package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node app.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs nodejs-getting-started
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls nodejs-getting-started
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /app/npm-debug.log

npm install: Error : Cannot find module 'tough-cookie'

I have removed and reinstalled node.js many times
> node -v
4.5.0
> npm -v
3.3.6
Once I run the command npm install request I get the following error :
Error: Cannot find module 'tough-cookie'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (C:\Users\Generic User\AppData\Roaming\npm\node_modules\npm\node_modules\request\lib\cookies.js:3:13)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Generic User\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "request"
npm ERR! node v4.5.0
npm ERR! npm v3.3.6
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module 'tough-cookie'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
You probably will tell me to run
> npm update -g npm
I get the same error for this command too.
It looks like your version 3 npm install is broken, for some reason. It'd be interesting to know whether this path exists:
C:\Users\Generic User\AppData\Roaming\npm\node_modules\npm\node_modules\request\node_modules\tough-cookie
and whether it contains a valid package, etc.
With your npm v 3 install, broken, none of the npm install or update commands will work (as they'll need the request module). However, you might be able to roll back npm - as version 4.5.0 of Node.js installs npm version 2.15.9 and it will still be there:
> npm uninstall -g npm
That should leave you with:
> npm -v
2.15.9
Before re-installing npm v 3, clear the cache:
> npm cache clear
> npm install -g npm
However, before you re-install version npm v 3, it would be interesting to see if you are able to install request with npm v 2.
In my case it was a .lock file that caused this error, deleting the file fixed it. Same problem and solution was reported here: https://github.com/sass/node-sass/issues/2019
Is there a package.json file in the folder you are running node from?
If there is a package.json, then running :
npm install request
will not have the desired effect, in fact npm will just try and install whatever module is described in package.json
Have you tried npm install tough-cookie
it has worked for me
its browser issue ... please try to open it in chrome incognito windows or firefox private window and delete cookies

node-sass install failing on Jenkins

I'm trying to set up Jenkins to run Gulp but it keeps failing while attempting to install node-sass (a dependency of the gulp-sass plugin).
The issue seems to be that node is not finding a script file during install. I verified that script does actually exist in the project repository. When I pull my repo locally on the server and install it, it installs without a problem. That makes me think it's a Jenkins related environment issue.
Here's the error output:
> node-sass#2.1.1 install /root/.jenkins/jobs/odyssey-frontend/workspace/node_modules/gulp-sass/node_modules/node-sass
> node scripts/install.js
module.js:338
throw err;
^
Error: Cannot find module '/root/.jenkins/jobs/odyssey-frontend/workspace/node_modules/gulp-sass/node_modules/node-sass/scripts/install.js'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
npm ERR! Linux 3.14.35-28.38.amzn1.x86_64
npm ERR! argv "node" "/home/ec2-user/.linuxbrew/bin/npm" "install" "--production"
npm ERR! node v0.12.2
npm ERR! npm v2.7.6
npm ERR! code ELIFECYCLE
npm ERR! node-sass#2.1.1 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass#2.1.1 install script 'node scripts/install.js'.
npm ERR! This is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node scripts/install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls node-sass
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /root/.jenkins/jobs/odyssey-frontend/workspace/npm-debug.log
module.js:338
throw err;
^
Error: Cannot find module 'gulp-sass'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/root/.jenkins/jobs/odyssey-frontend/workspace/gulpfile.js:11:12)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
Build step 'Execute shell' marked build as failure
Finished: FAILURE
The Linux distribution is Amazon Linux AMI, Fedora-like. Trying to install node-sass ^2.0.1 via gulp-sass ^1.3.3.
I just tried the updated gulp-sass 2.0.0 with node-sass 3.0.0 and still have the same issue.
I removed all node-sass dependencies and it builds successfully now. So its really just that package; all other node packages install successfully.
I posted this on the Github project where it was answered: https://github.com/sass/node-sass/issues/941#issuecomment-100414516
Jenkins seems to run everything as sudo when building. NPM, as a security feature, won't run install scripts as sudo, hence the error. Adding a --unsafe-perm flag to the install script gets by this issue.

Resources