Gulp assertion error


#1

Hi,

I’ve had major problem trying to install nearly everything in chapter7 concerning the front end fun with sass, gulp and bootstrap 4.
Apologies if some of this appears to be duplicated. This is because I have tried installing this multiple times.

Libsass wasn’t a problem and installation was a breeze up until the point of installing gulp.

npm install -g --save-dev gulp-sass gulp-concat gulp-rename

This gave the warning:-

npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules

which led on to this bunch of errors:-

npm ERR! Linux 4.15.0-55-generic
npm ERR! argv “/usr/bin/node” “/usr/bin/npm” “install” “-g” “–save-dev” “gulp-sass” “gulp-concat” “gulp-rename”
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access

npm ERR! Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules’
npm ERR! { Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules’
npm ERR! errno: -13,
npm ERR! code: ‘EACCES’,
npm ERR! syscall: ‘access’,
npm ERR! path: ‘/usr/local/lib/node_modules’ }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR! /home/david/projects/boat/npm-debug.log

I then ran the same with elevated privileges, which seemed to correct the issues.

After this came the line “npm install --save-dev gulp” where it complained that this should be run globally with the -g switch. Also, I could see that it was also going to have permissions problems with usr/local/…
So I ran this with “sudo npm install -g --save-dev gulp” instead.

Then it came to running gulp I could not solve it despite looking on google and :-

(venv) david@david-VirtualBox:~/projects/boat$ gulp
assert.js:42
throw new errors.AssertionError({
^

AssertionError [ERR_ASSERTION]: Task function must be specified
at Gulp.set [as _setTask] (/home/david/projects/boat/node_modules/undertaker/lib/set-task.js:10:3)
at Gulp.task (/home/david/projects/boat/node_modules/undertaker/lib/task.js:13:8)
at Object. (/home/david/projects/boat/gulpfile.js:43:6)
at Module._compile (module.js:652:30)
at Object.Module._extensions…js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
(venv) david@david-VirtualBox:~/projects/boat$ sudo gulp
assert.js:42
throw new errors.AssertionError({
^

AssertionError [ERR_ASSERTION]: Task function must be specified
at Gulp.set [as _setTask] (/home/david/projects/boat/node_modules/undertaker/lib/set-task.js:10:3)
at Gulp.task (/home/david/projects/boat/node_modules/undertaker/lib/task.js:13:8)
at Object. (/home/david/projects/boat/gulpfile.js:43:6)
at Module._compile (module.js:652:30)
at Object.Module._extensions…js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)

I even tried the method for installing this at this link https://tecadmin.net/install-gulp-js-on-ubuntu/ but this still gave the permissions problem:-

(venv) david@david-VirtualBox:~/projects/boat$ npm install -g gulp
npm WARN checkPermissions Missing write access to /usr/lib/node_modules
npm ERR! path /usr/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access ‘/usr/lib/node_modules’
npm ERR! { [Error: EACCES: permission denied, access ‘/usr/lib/node_modules’]
npm ERR! stack:
npm ERR! ‘Error: EACCES: permission denied, access ‘/usr/lib/node_modules’’,
npm ERR! errno: -13,
npm ERR! code: ‘EACCES’,
npm ERR! syscall: ‘access’,
npm ERR! path: ‘/usr/lib/node_modules’ }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR! /home/david/.npm/_logs/2019-08-31T00_54_49_258Z-debug.log

I give up otherwise I will end up with a broken system. I think I will go down the manual route of adding bootstrap, unless anyone has a solution to this problem…

Dave Johns


#2

Unfortunately this sounds like an issue with your computer’s permissions (and your $PATH), which is really difficult to diagnose online.

Does this help?


#3

Hi Tracy,
Thanks for the reply. I did wonder why the heck they are trying to install stuff in /usr/lib without elevated access rights. I have read that using sudo will give troubles ahead and also I would not like to change the permissions of these root access directories just for the benefit of npm. The /usr directory has always been root access only and probably always will be.
I wonder if this is just an issue with Debian based distros, but I don’t think so. I have no idea what they were thinking.
Anyway, I will attempt to install npm as per the link that you kindly posted. I’ll let you know the outcome.

Dave


#4

Hi again… Unable to install npm…

david@david-VirtualBox:~$ sudo apt install npm
[sudo] password for david:           
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies.
 npm : Depends: nodejs but it is not going to be installed
       Depends: node-abbrev (>= 1.0.4) but it is not going to be installed
       Depends: node-ansi (>= 0.3.0-2) but it is not going to be installed
       Depends: node-ansi-color-table but it is not going to be installed
       Depends: node-archy but it is not going to be installed
       Depends: node-block-stream but it is not going to be installed
       Depends: node-fstream (>= 0.1.22) but it is not going to be installed
       Depends: node-fstream-ignore but it is not going to be installed
       Depends: node-github-url-from-git but it is not going to be installed
       Depends: node-glob (>= 3.1.21) but it is not going to be installed
       Depends: node-graceful-fs (>= 2.0.0) but it is not going to be installed
       Depends: node-inherits but it is not going to be installed
       Depends: node-ini (>= 1.1.0) but it is not going to be installed
       Depends: node-lockfile but it is not going to be installed
       Depends: node-lru-cache (>= 2.3.0) but it is not going to be installed
       Depends: node-minimatch (>= 0.2.11) but it is not going to be installed
       Depends: node-mkdirp (>= 0.3.3) but it is not going to be installed
       Depends: node-gyp (>= 0.10.9) but it is not going to be installed
       Depends: node-nopt (>= 3.0.1) but it is not going to be installed
       Depends: node-npmlog but it is not going to be installed
       Depends: node-once but it is not going to be installed
       Depends: node-osenv but it is not going to be installed
       Depends: node-read but it is not going to be installed
       Depends: node-read-package-json (>= 1.1.0) but it is not going to be installed
       Depends: node-request (>= 2.25.0) but it is not going to be installed
       Depends: node-retry but it is not going to be installed
       Depends: node-rimraf (>= 2.2.2) but it is not going to be installed
       Depends: node-semver (>= 2.1.0) but it is not going to be installed
       Depends: node-sha but it is not going to be installed
       Depends: node-slide but it is not going to be installed
       Depends: node-tar (>= 0.1.18) but it is not going to be installed
       Depends: node-underscore but it is not going to be installed
       Depends: node-which but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

That doesn’t look good and is most likely the result of installing npm with elevated access rights.I think I will give up sass, gulp and npm etc and do things manually with crispy forms and bootstrap 4.