0

I purchased an HTML5 template and the files need to be compiled with NodeJS. I have no experience with NodeJS and I'm running into errors. I'll provide everything I think is relevant but please let me know what other information might be helpful.

Here are my NodeJS results when running the install.bat: screenshot of npm results

Here is the install.bat:

@echo off
echo == Installing Intense ==
echo Step 1: installing gulp-cli@2.3.0 globally
call npm i gulp-cli@2.3.0 -g
echo Step 2: installing project packages
call npm i
echo Step 3: generating a public version of the site
call gulp build::dist
echo Step 4: generating projects for Novi builder
call gulp build::proj
echo Step 5: generating Novi Builder demo projects
call gulp build::demo
echo == Installation completed ==
pause

Here is the package.json:

{
  "name": "intense",
  "version": "4.15.0",
  "description": "Multipage site template",
  "main": "gulpfile.js",
  "scripts": {
    "express": "node server.js"
  },
  "author": "TemplateMonster",
  "license": "UNLICENSED",
  "devDependencies": {
    "connect-multiparty": "2.2.0",
    "oxyz-build": "1.2.2",
    "oxyz-express": "1.0.2",
    "html-minifier": "4.0.0",
    "html2json": "1.0.2",
    "pretty": "2.0.0"
  }
}

The gulpfile.js:

const
    path = require( 'path' ),
    glob = require( 'glob' ),
    gulp = require( 'gulp' );

let
    tmp = {},
    tasks = {};

glob.sync( './dev/*/build.config.js' ).forEach( function ( str ) {
    let
        siteName = path.parse( str ).dir.split( '/' ).pop(),
        siteTasks = require( str );

    for ( let key in siteTasks ) {
        if ( !tmp[ key ] ) tmp[ key ] = {};
        tmp[ key ][ siteName ] = siteTasks[ key ];
    }

    for ( let taskName in tmp ) {
        tasks[ `build::${taskName}` ] = gulp.series( Object.values( tmp[ taskName ] ) );
    }

    for ( let taskName in tmp ) {
        for ( let siteName in tmp[ taskName ] ) {
            tasks[ `build::${taskName}::${siteName}` ] = tmp[ taskName ][siteName];
        }
    }
});

module.exports = tasks;

The log file listed in the output is really long but it ends with this:

315 verbose stack Error: spawn bash ENOENT
5315 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
5315 verbose stack     at onErrorNT (node:internal/child_process:480:16)
5315 verbose stack     at processTicksAndRejections (node:internal/process/task_queues:81:21)
5316 verbose pkgid node-sass@4.14.1
5317 verbose cwd C:\Code\IntenseTheme\1519369-1609160745508_58888
5318 verbose Windows_NT 10.0.18363
5319 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i"
5320 verbose node v15.11.0
5321 verbose npm  v7.6.2
5322 error code ENOENT
5323 error syscall spawn bash
5324 error path C:\Code\IntenseTheme\1519369-1609160745508_58888\node_modules\node-sass
5325 error errno -4058
5326 error enoent spawn bash ENOENT
5327 error enoent This is related to npm not being able to find a file.
5328 verbose exit -4058

I have tried updating some of the packages I see in the warnings like this:

C:\Code\IntenseTheme\1519369-1609160745508_58888>npm install chokidar@3.5 -g

added 1 package, changed 14 packages, and audited 17 packages in 3s

found 0 vulnerabilities

C:\Code\IntenseTheme\1519369-1609160745508_58888>npm install debug@4.3.1 -g

added 2 packages, and audited 4 packages in 3s

found 0 vulnerabilities

C:\Code\IntenseTheme\1519369-1609160745508_58888>npm install axios@0.21.1 -g

added 2 packages, and audited 4 packages in 3s

found 0 vulnerabilities

But then when I try npm i again I get the exact same results as though nothing actually upgraded.

UPDATE:

Using NVM I switched to Node 14.15.5 and now I'm getting a new error on the second step: npm ERR! node-sass@4.14.1 install: node scripts/install.js npm ERR! Failed at the node-sass@4.14.1 install script.

Before I was able to use node-sass although I wish I noted which versions of everything I was using at the time (I'm learning.) However, now I get this error whenever I try to install any version of node-sass in any folder.

Here are my current versions: npm: '6.14.11', node: '14.15.5'

RidicCoder
  • 88
  • 8
  • Hi. What will be the production environtment for your application: on-premise, cloud, linux, etc? I think your error is related to windows. Test it on linux. – JRichardsz Mar 11 '21 at 14:33
  • Sorry, I may have used incorrect terminology. I'm just trying to extract the .html, .js and .css files from these .pug, .scss and who knows what other kind of files. It's just supposed to extract these files into another subdirectory in this same folder. I don't have a way to test on linux. – RidicCoder Mar 11 '21 at 14:36
  • 1
    If you are using nodej pug framework, there is not task to "extract files". Pug is a template framework, which generates html pages at runtime or dynamically. I think you just need to see what it looks like your purcahsed template. In this case and according to your package.json you just need to execute **npm install** and then **npm run express** – JRichardsz Mar 11 '21 at 17:47
  • When I execute npm install I get the errors in the screenshot above. What will npm run express do? I'm assuming I need to wait to run that until after I get a successful install first? – RidicCoder Mar 11 '21 at 19:16
  • @JRichardsz Thank you for pointing out that this is specific to pug. I will add it to the title and tags. – RidicCoder Mar 11 '21 at 20:49
  • Try to test your code in a linux machine. Windows or your nodejs version are the problem. I found this: https://www.katacoda.com/courses/nodejs/playground which has node 10 and git – JRichardsz Mar 12 '21 at 13:59
  • Thank you for that. Using NVM I was able to try lots of various versions to no avail. I still do not have access to a linux machine. – RidicCoder Mar 17 '21 at 01:38

0 Answers0