I get the following error when running npm build

Theophilus
{
    "name": "confusion",
    "version": "1.0.0",
    "main": "index.js",
    "dependencies": {
        "bootstrap-social": "^5.1.1",
        "font-awesome": "^4.7.0",
        "jquery": "^3.3.1",
        "lite-server": "^2.4.0",
        "popper.js": "^1.12.9"
    },
    "devDependencies": {
        "cssmin": "^0.4.3",
        "htmlmin": "0.0.7",
        "node-sass": "^4.7.2",
        "onchange": "^3.3.0",
        "parallelshell": "^3.0.2",
        "rimraf": "^2.6.2",
        "uglifyjs": "^2.4.11",
        "usemin-cli": "^0.5.1"
    },
    "scripts": {
        "start": "npm run watch:all",
        "test": "echo \"Error: no test specified\" && exit 1",
        "lite": "lite-server",
        "scss": "node-sass -o css/ css/",
        "watch:scss": "onchange \"css/*.scss\" -- npm run scss",
        "watch:all": "parallelshell \"npm run watch:scss\" \"npm run lite\"",
        "clean": "rimraf dist",
        "copyfonts": "copyfiles -f node_modules/font-awesome/fonts/* dist/fonts",
        "imagemin": "imagemin img/* -o dist/img",
        "usemin": "usemin contactus.html -d dist --htmlmin -o dist/contactus.html && usemin aboutus.html -d dist --htmlmin -o dist/aboutus.html && usemin index.html -d dist --htmlmin -o dist/index.html",
        "build": "npm run clean && npm run imagemin && npm run copyfonts && npm run usemin"
    }
}

C:\Users\username\Documents\coursera\Bootstrap4\conFusion>npm run build

> [email protected] build C:\Users\username\Documents\coursera\Bootstrap4\conFusion
> npm run clean && npm run imagemin && npm run copyfonts && npm run usemin

> [email protected] clean C:\Users\username\Documents\coursera\Bootstrap4\conFusion
> rimraf dist

> [email protected] imagemin C:\Users\username\Documents\coursera\Bootstrap4\conFusion
> imagemin img/* -o dist/img

4 images minified

> [email protected] copyfonts C:\Users\username\Documents\coursera\Bootstrap4\conFusion
> copyfiles -f node_modules/font-awesome/fonts/* dist/fonts

> [email protected] usemin C:\Users\username\Documents\coursera\Bootstrap4\conFusion
> usemin contactus.html -d dist --htmlmin -o dist/contactus.html && usemin aboutus.html -d dist --htmlmin -o dist/aboutus.html && usemin index.html -d dist --htmlmin -o dist/index.html

undefined:1625
    throw new JS_Parse_Error(message, filename, line, col, pos);
    ^
SyntaxError: Unexpected token: punc ({)
    at JS_Parse_Error.get (eval at <anonymous> (C:\Users\username\Documents\coursera\Bootstrap4\conFusion\node_modules\usemin\node_modules\uglify-js\tools\node.js:27:1), <anonymous>:86:23)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] usemin: `usemin contactus.html -d dist --htmlmin -o dist/contactus.html && usemin aboutus.html -d dist --htmlmin -o dist/aboutus.html && usemin index.html -d dist --htmlmin -o dist/index.html`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] usemin 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\username\AppData\Roaming\npm-cache\_logs\2018-09-24T21_38_01_183Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `npm run clean && npm run imagemin && npm run copyfonts && npm run usemin`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Timija F

I am doing the same course and had the same errors. However, I was just able to fix it. I did this by reinstalling all dev dependencies and used the current versions, not the ones in the course. I did also change the usemin command (according to the post here) to

"imagemin": "imagemin img/* --out-dir=dist/img",

However, it still did not work, so I checked all my files for errors using the following tools:

https://www.freeformatter.com/java-regex-tester.html for testing the html files; http://www.webtoolkitonline.com/javascript-tester.html, for testing the .js file and https://jsonlint.com/?json=, to test the package.json file for errors.

After I did correct all the files, the command "npm run build" did finally work. (I especially forgot to check the script.js file where I just copied the code from the html file that still contained the script tags)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

npm run build error when running "npm run build"

when running npm start, to start a react project I get the following messages on the terminal

Error when updating node following command npm i npm

I get the following error when i try to connect sonarqube with azure devops build pipeline

When I try to build app by Android studio , I get the following error that the Gradle tasks connects timeout

Why i get hashed .jpeg file when running 'npm run build' with webpack

Following the Docker getting started pages and I get an error on Centos 7.4 when running their Python test image

When I run the command to build ionic app: ionic cordova build android --prod --verbose. I get the following error:

I get an high vulnerbility error when im running npm i uuid

React Typescript ERROR when running npm run build with webpack

Error is triggered when i am running npm init

I get an error when running the Dockerfile

When attempting to compile a boost project I get the following error

I get the following error when trying to set a wallpaper

Running docker-compose up -d -build , I got the following error:

I'm trying to make a simple app in flutter that fetches data from an API. However when I try running the code I get the following error

webpack error while running npm run build

When I run npm run start I get this error

I receive the following error when I tried to trigger a build from Visual Studio 2017 that is connected to TFS 2015

How can I resolve the following compilation error when running Jest for testing?

Why am I getting the following error when running Google App from eclipse?

Why am I getting a "Type Mismatch" error when running the following formula in VBA?

I get an error when i build my project in kotlin

npm run build is not cached when running docker build with kaniko cache

Error when running npm install gulp on kudu

Cycle error occurs when running 'npm start'?

Getting kexec error when running npm install

I get a buch of errors when i try to run the npm run build command

Receiving an npm error after running "npm run build" : npm ERR! code ELIFECYCLE npm ERR! errno 2