I have installed webpack for my project. However, when I try to run a command to convert scss in to css i get an error that says "Please include the following file with any support request: C:\wamp\www\chandco\wp-content\themes\chandco\npm-debug.log".
The thing is this file already exists so I;m confused where the problem is.
Any help will be appreciated.
Thanks.
npm-debug-log file
====================
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program
Files\\nodejs\\node_modules\\npm\\bin\\npm-
cli.js',
1 verbose cli 'run',
1 verbose cli 'watch' ]
2 info using npm#3.10.10
3 info using node#v6.11.2
4 verbose run-script [ 'prewatch', 'watch', 'postwatch' ]
5 info lifecycle chandco-group#1.0.0~prewatch: chandco-group#1.0.0
6 silly lifecycle chandco-group#1.0.0~prewatch: no script for prewatch, continuing
7 info lifecycle chandco-group#1.0.0~watch: chandco-group#1.0.0
8 verbose lifecycle chandco-group#1.0.0~watch: unsafe-perm in lifecycle true
9 verbose lifecycle chandco-group#1.0.0~watch: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\wamp\www\chandco\wp-content\themes\chandco\node_modules\.bin;C:\Program Files\Docker\Docker\Resources\bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Git\cmd;C:\Program Files\PuTTY\;C:\Program Files\nodejs\;C:\Users\Raj.Chudasama\AppData\Local\Microsoft\WindowsApps;C:\Users\Raj.Chudasama\AppData\Local\atom\bin;C:\Users\Raj.Chudasama\AppData\Local\Microsoft\WindowsApps;C:\Users\Raj.Chudasama\AppData\Roaming\npm
10 verbose lifecycle chandco-group#1.0.0~watch: CWD: C:\wamp\www\chandco\wp-content\themes\chandco
11 silly lifecycle chandco-group#1.0.0~watch: Args: [ '/d /s /c', 'webpack --watch' ]
12 silly lifecycle chandco-group#1.0.0~watch: Returned: code: 1 signal: null
13 info lifecycle chandco-group#1.0.0~watch: Failed to exec watch script
14 verbose stack Error: chandco-group#1.0.0 watch: `webpack --watch`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:891:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid chandco-group#1.0.0
16 verbose cwd C:\wamp\www\chandco\wp-content\themes\chandco
17 error Windows_NT 10.0.15063
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "watch"
19 error node v6.11.2
20 error npm v3.10.10
21 error code ELIFECYCLE
22 error chandco-group#1.0.0 watch: `webpack --watch`
22 error Exit status 1
23 error Failed at the chandco-group#1.0.0 watch script 'webpack --watch'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the chandco-group package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error webpack --watch
23 error You can get information on how to open an issue for this project with:
23 error npm bugs chandco-group
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls chandco-group
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
`
package.json file
================
`{
"name": "chandco-group",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"watch": "webpack --watch"
},
"author": "Raj Chudasama",
"license": "ISC",
"devDependencies": {
"css-loader": "^0.28.4",
"extract-text-webpack-plugin": "^3.0.0",
"node-sass": "^4.5.3",
"sass-loader": "^6.0.6",
"style-loader": "^0.18.2",
"webpack": "^3.4.1",
"webpack-dev-server": "^2.6.1"
}
}
`
webpack.confile file
====================
`var webpack = require('webpack');
var path = require('path');
var config = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, './public'),
filename: 'output.js'
},
module: {
rules: [
{
test: /\.scss$/,
use: ExtractTextWebpackPlugin.extract({
use:['css-loader', 'sass-loader'],
fallback: 'style-loader'
})
}
]
},
plugins: [
new ExtractTextWebpackPlugin('styles.css')
]
}
module.exports = config;
`
I solved this by requiring the webpack text extract plugin at the top of the page.
Related
i just installed nestjs and i'm running it in vscode according to the documentation i should be able to run the project by the code
npm run start
but i'm getting an error that im missing script: start
documentation says that it should give me hello world when i run the localhost port
0 verbose cli /var/lib/snapd/snap/node/6895/bin/node /var/lib/snapd/snap/node/6895/bin/npm
1 info using npm#8.19.2
2 info using node#v16.18.1
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:/var/lib/snapd/snap/node/6895/lib/node_modules/npm/npmrc Completed in 2ms
6 timing config:load:builtin Completed in 2ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 1ms
9 timing config:load:project Completed in 5ms
10 timing config:load:file:/home/ramanm/.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:/var/lib/snapd/snap/node/6895/etc/npmrc Completed in 3ms
13 timing config:load:global Completed in 3ms
14 timing config:load:validate Completed in 1ms
15 timing config:load:credentials Completed in 1ms
16 timing config:load:setEnvs Completed in 1ms
17 timing config:load Completed in 19ms
18 timing npm:load:configload Completed in 19ms
19 timing npm:load:mkdirpcache Completed in 6ms
20 timing npm:load:mkdirplogs Completed in 1ms
21 verbose title npm run start
22 verbose argv "run" "start"
23 timing npm:load:setTitle Completed in 2ms
24 timing config:load:flatten Completed in 3ms
25 timing npm:load:display Completed in 6ms
26 verbose logfile logs-max:10 dir:/home/ramanm/.npm/_logs
27 verbose logfile /home/ramanm/.npm/_logs/2022-11-16T12_34_58_739Z-debug-0.log
28 timing npm:load:logFile Completed in 6ms
29 timing npm:load:timers Completed in 0ms
30 timing npm:load:configScope Completed in 0ms
31 timing npm:load Completed in 41ms
32 silly logfile start cleaning logs, removing 1 files
33 silly logfile done cleaning log files
34 timing command:run Completed in 11ms
35 verbose stack Error: Missing script: "start"
35 verbose stack
35 verbose stack Did you mean one of these?
35 verbose stack npm star # Mark your favorite packages
35 verbose stack npm stars # View packages marked as favorites
35 verbose stack
35 verbose stack To see a list of scripts, run:
35 verbose stack npm run
35 verbose stack at RunScript.run (/var/lib/snapd/snap/node/6895/lib/node_modules/npm/lib/commands/run-script.js:98:13)
35 verbose stack at async module.exports (/var/lib/snapd/snap/node/6895/lib/node_modules/npm/lib/cli.js:78:5)
36 verbose cwd /home/ramanm/workspace/nestPrac
37 verbose Linux 5.15.76-1-MANJARO
38 verbose node v16.18.1
39 verbose npm v8.19.2
40 error Missing script: "start"
40 error
40 error Did you mean one of these?
40 error npm star # Mark your favorite packages
40 error npm stars # View packages marked as favorites
40 error
40 error To see a list of scripts, run:
40 error npm run
41 verbose exit 1
42 timing npm Completed in 68ms
43 verbose code 1
44 error A complete log of this run can be found in:
44 error /home/ramanm/.npm/_logs/2022-11-16T12_34_58_739Z-debug-0.log
{
"name": "prac",
"version": "0.0.1",
"description": "",
"author": "",
"private": true,
"license": "UNLICENSED",
"scripts": {
"prebuild": "rimraf dist",
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start",
"start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json"
},
"dependencies": {
"#nestjs/common": "^9.0.0",
"#nestjs/core": "^9.0.0",
"#nestjs/platform-express": "^9.0.0",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.2.0"
},
"devDependencies": {
"#nestjs/cli": "^9.0.0",
"#nestjs/schematics": "^9.0.0",
"#nestjs/testing": "^9.0.0",
"#types/express": "^4.17.13",
"#types/jest": "28.1.8",
"#types/node": "^16.0.0",
"#types/supertest": "^2.0.11",
"#typescript-eslint/eslint-plugin": "^5.0.0",
"#typescript-eslint/parser": "^5.0.0",
"eslint": "^8.0.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "28.1.3",
"prettier": "^2.3.2",
"source-map-support": "^0.5.20",
"supertest": "^6.1.3",
"ts-jest": "28.0.8",
"ts-loader": "^9.2.3",
"ts-node": "^10.0.0",
"tsconfig-paths": "4.1.0",
"typescript": "^4.7.4"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": "src",
"testRegex": ".*\\.spec\\.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"collectCoverageFrom": [
"**/*.(t|j)s"
],
"coverageDirectory": "../coverage",
"testEnvironment": "node"
}
}
You can run npm update or delete the node_modules folder and try to reinstall the node modules all again. i.e. rm -rf node_modules && npm install
You can also run npm cache clean to clear the npm cache.
If you didn't, you'd better install nest.js cli by running npm i -g #nestjs/cli
And
$ cd /some/project/root/folder
$ npm install -D #nestjs/cli
It's one of those days where I simply open my localhost and expect things to run smoothly but nope!
I am currently running into 2 errors when kick-starting an Angular 4 app to http://localhost:3000/ and I am not sure why these errors are occurring:
node_modules/typescript/lib/lib.d.ts(105,14): error TS2300: Duplicate identifier 'PropertyKey'.
typings/globals/core-js/index.d.ts(3,14): error TS2300: Duplicate identifier 'PropertyKey'.
My Windows 10 machine is currently installed with Node version 10.14.0 and npm version of 6.9.0.
My package.json is:
{
"name": "angular4-web-app",
"version": "1.0.0",
"author": "Mark",
"description": "Angular 4 Web App on SystemJS",
"homepage": "https://fakehomepage.com",
"scripts": {
"start": "tsc && concurrently \"tsc -w\" \"lite-server\" \"gulp sass\" \"gulp sass:watch\" ",
"start:dev": "copy \"environment_dev.ts\" \"./app/shared/environment/global.constants.ts\" && npm run start",
"start:qa": "copy \"environment_qa.ts\" \"./app/shared/environment/global.constants.ts\" && npm run start",
"start:prod": "copy \"environment_prod.ts\" \"./app/shared/environment/global.constants.ts\" && npm run start",
"tsc": "tsc",
"tsc:w": "tsc -w",
"lint": "tslint ./app/**/*.ts -t verbose",
"lite": "lite-server",
"sass": "gulp sass",
"sass:watch": "gulp sass:watch",
"build:dev": "copy \"environment_dev.ts\" \"./app/shared/environment/global.constants.ts\" && gulp bundle-lower",
"build:qa": "copy \"environment_qa.ts\" \"./app/shared/environment/global.constants.ts\" && gulp bundle-lower",
"build:prod": "copy \"environment_prod.ts\" \"./app/shared/environment/global.constants.ts\" && gulp bundle-prod",
"final": "gulp buildmini",
"destroy": "gulp clean"
},
"license": "ISC",
"dependencies": {
"#angular/common": "4.4.7",
"#angular/compiler": "4.4.7",
"#angular/core": "4.4.7",
"#angular/forms": "4.4.7",
"#angular/http": "4.4.7",
"#angular/platform-browser": "4.4.7",
"#angular/platform-browser-dynamic": "4.4.7",
"#angular/router": "4.4.7",
"#ngx-translate/core": "^6.0.1",
"#ngx-translate/http-loader": "0.0.3",
"#types/highcharts": "^4.2.57",
"angular2-highcharts": "^0.5.5",
"animate.css": "^3.5.2",
"bootstrap": "^3.4.1",
"bootstrap-social": "^5.1.1",
"core-js": "^2.4.1",
"font-awesome": "~4.7.0",
"gulp": "^3.9.1",
"gulp-htmlmin": "^5.0.1",
"highcharts": "^5.0.12",
"jquery": "^3.4.1",
"jquery-slimscroll": "^1.3.8",
"lodash": "^4.17.15",
"moment": "^2.18.1",
"ng2-breadcrumb": "^0.5.14",
"ng2-daterangepicker": "^2.0.8",
"ngx-bootstrap": "^2.0.5",
"ngx-infinite-scroll": "^0.5.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.4.2",
"systemjs": "0.19.27",
"zone.js": "^0.6.23"
},
"devDependencies": {
"#types/node": "^6.0.60",
"concurrently": "^3.1.0",
"connect-history-api-fallback": "^1.3.0",
"del": "^2.2.2",
"gulp-clean-css": "^3.9.0",
"gulp-concat": "^2.6.1",
"gulp-sass": "^3.1.0",
"gulp-sourcemaps": "^2.6.0",
"gulp-systemjs-builder": "^0.15.0",
"gulp-typescript": "^3.2.1",
"gulp-uglify": "^3.0.0",
"lite-server": "^2.3.0",
"tslint": "^3.7.4",
"typescript": "^2.2.2"
},
"repository": {
"type": "git",
"url": "https://bitbucket.org/mark/angular4-web-app.git"
}
}
My tsconfig.json is:
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": true,
"removeComments": true,
"sourceMap": true,
"suppressImplicitAnyIndexErrors": true,
"target": "es5",
"types" : []
},
"exclude": [
"node_modules/*",
"environment_dev.ts",
"environment_qa.ts",
"environment_prod.ts"
]
}
The debug log in full:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\Mark\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'start:dev' ]
2 info using npm#6.9.0
3 info using node#v10.14.0
4 verbose run-script [ 'prestart:dev', 'start:dev', 'poststart:dev' ]
5 info lifecycle angular4-web-app#1.0.0~prestart:dev: angular4-web-app#1.0.0
6 info lifecycle angular4-web-app#1.0.0~start:dev: angular4-web-app#1.0.0
7 verbose lifecycle angular4-web-app#1.0.0~start:dev: unsafe-perm in lifecycle true
8 verbose lifecycle angular4-web-app#1.0.0~start:dev: PATH: C:\Users\Mark\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Mark\Desktop\Development\Bitbucket\Angular 4 Web App\node_modules\.bin;C:\Users\Mark\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\Mark\bin;C:\Users\Mark\AppData\Local\SourceTree\app-2.1.10\lib\win32\x64;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Intel\iCLS Client;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\Git\cmd;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio;C:\Program Files\dotnet;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\HashiCorp\Vagrant\bin;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\TortoiseSVN\bin;C:\Program Files\PuTTY;C:\Program Files\nodejs;C:\WINDOWS\System32\OpenSSH;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn;C:\Program Files\Microsoft SQL Server\140\Tools\Binn;C:\Program Files\Microsoft SQL Server\140\DTS\Binn;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Python34\Scripts;C:\Users\Mark\AppData\Local\Programs\Python\Python38-32\Scripts;C:\Users\Mark\AppData\Local\Programs\Python\Python38-32;C:\Users\Mark\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Users\Mark\AppData\Roaming\npm;C:\Users\Mark\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
9 verbose lifecycle angular4-web-app#1.0.0~start:dev: CWD: C:\Users\Mark\Desktop\Development\Bitbucket\Angular 4 Web App
10 silly lifecycle angular4-web-app#1.0.0~start:dev: Args: [ '/d /s /c',
10 silly lifecycle 'copy "environment_dev.ts" "./app/shared/environment/global.constants.ts" && npm run start' ]
11 silly lifecycle angular4-web-app#1.0.0~start:dev: Returned: code: 2 signal: null
12 info lifecycle angular4-web-app#1.0.0~start:dev: Failed to exec start:dev script
13 verbose stack Error: angular4-web-app#1.0.0 start:dev: `copy "environment_dev.ts" "./app/shared/environment/global.constants.ts" && npm run start`
13 verbose stack Exit status 2
13 verbose stack at EventEmitter.<anonymous> (C:\Users\Mark\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:182:13)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\Mark\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:182:13)
13 verbose stack at maybeClose (internal/child_process.js:962:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid angular4-web-app#1.0.0
15 verbose cwd C:\Users\Mark\Desktop\Development\Bitbucket\Angular 4 Web App
16 verbose Windows_NT 10.0.18362
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Mark\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "start:dev"
18 verbose node v10.14.0
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 2
22 error angular4-web-app#1.0.0 start:dev: `copy "environment_dev.ts" "./app/shared/environment/global.constants.ts" && npm run start`
22 error Exit status 2
23 error Failed at the angular4-web-app#1.0.0 start:dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]
And here's what the file system looks like:
Final fix was to do the obvious yet unorthodox method of removing node_modules in full and then running an npm install on this app.
Try upgrading your #types/core-js with the command npm install --save #types/core-js
hope this helped :D
When I run "npm run build" on my shared hosting server it throws an error: spawn ENOMEM
It runs fine on my localhost and was running fine on the hosting server for a couple of weeks until yesterday.
> mysite#1.0.0 build /home/user123/public_html
> next build
Creating an optimized production build ...internal/child_process.js:366
throw errnoException(err, 'spawn');
^
Error: spawn ENOMEM
at ChildProcess.spawn (internal/child_process.js:366:11)
at spawn (child_process.js:551:9)
at Object.fork (child_process.js:113:10)
at ChildProcessWorker.initialize (/home/user123/public_html/node_modules/jest-worker/build/workers/ChildProcessWorker.js:137:44)
at new ChildProcessWorker (/home/user123/public_html/node_modules/jest-worker/build/workers/ChildProcessWorker.js:127:10)
at WorkerPool.createWorker (/home/user123/public_html/node_modules/jest-worker/build/WorkerPool.js:44:12)
at new BaseWorkerPool (/home/user123/public_html/node_modules/jest-worker/build/base/BaseWorkerPool.js:82:27)
at new WorkerPool (/home/user123/public_html/node_modules/jest-worker/build/WorkerPool.js:30:1)
at new JestWorker (/home/user123/public_html/node_modules/jest-worker/build/index.js:131:26)
at TaskRunner.run (/home/user123/public_html/node_modules/next/dist/build/webpack/plugins/terser-webpack-plugin/src/TaskRunner.js:3:166)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mysite#1.0.0 build: `next build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mysite#1.0.0 build 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! /home/user123/.npm/_logs/2019-09-24T19_27_41_300Z-debug.log
and this is the debug log
0 info it worked if it ends with ok
1 verbose cli [ '/home/user123/node/bin/node',
1 verbose cli '/home/user123/node/bin/npm',
1 verbose cli 'run',
1 verbose cli 'build' ]
2 info using npm#6.11.3
3 info using node#v10.16.3
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle mysite#1.0.0~prebuild: mysite#1.0.0
6 info lifecycle mysite#1.0.0~build: mysite#1.0.0
7 verbose lifecycle mysite#1.0.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle mysite#1.0.0~build: PATH: /home/user123/node/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/user123/public_html/node_modules/.bin:/home/user123/node/bin:/home/user123/node/bin:/usr/local/cpanel/3rdparty/lib/path-bin:/usr/local/jdk/bin:/usr/local/cpanel/3rdparty/lib/path-bin:/usr/local/cpanel/3rdparty/lib/path-bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/cpanel/composer/bin:/opt/puppetlabs/bin:/opt/dell/srvadmin/bin:/usr/local/bin:/usr/X11R6/bin:/home/user123/.local/bin:/home/user123/bin
9 verbose lifecycle mysite#1.0.0~build: CWD: /home/user123/public_html
10 silly lifecycle mysite#1.0.0~build: Args: [ '-c', 'next build' ]
11 silly lifecycle mysite#1.0.0~build: Returned: code: 1 signal: null
12 info lifecycle mysite#1.0.0~build: Failed to exec build script
13 verbose stack Error: mysite#1.0.0 build: `next build`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/home/user123/node/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess.<anonymous> (/home/user123/node/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid mysite#1.0.0
15 verbose cwd /home/user123/public_html
16 verbose Linux 2.6.32-954.3.5.lve1.4.66.el6.x86_64
17 verbose argv "/home/user123/node/bin/node" "/home/user123/node/bin/npm" "run" "build"
18 verbose node v10.16.3
19 verbose npm v6.11.3
20 error code ELIFECYCLE
21 error errno 1
22 error mysite#1.0.0 build: `next build`
22 error Exit status 1
23 error Failed at the mysite#1.0.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
I am using express and next js .
This is my server.js
const express = require( 'express' );
const next = require( 'next' );
// Import middleware.
const routes = require( './routes' );
// Setup app.
const app = next( { dev: 'production' !== process.env.NODE_ENV } );
const handle = app.getRequestHandler();
const handler = routes.getRequestHandler( app );
app.prepare()
.then( () => {
// Create server.
const server = express();
// Use our handler for requests.
server.use( handler );
// Don't remove. Important for the server to work. Default route.
server.get( '*', ( req, res ) => {
return handle( req, res );
} );
// Get current port.
const port = process.env.PORT || 8080;
// Error check.
server.listen( port, err => {
if ( err ) {
throw err;
}
// Where we starting, yo!
console.log( `> Ready on port ${port}...` );
} );
} );
I've looked into swap space / memory and it seems like it's fine
total used free shared buffers cached
Mem: 31906 31330 575 21 2982 16900
-/+ buffers/cache: 11447 20459
Swap: 8191 0 8191
I've also tried doing NODE_OPTIONS=--max-old-space-size=2048 npm run build and still doesn't work
Anyone have any idea what's wrong?
It seems like it is related to the NextJs version 9 as it consumes too much memory for building the app. You can find discussion about that issue here: https://github.com/zeit/next.js/issues/7929
Version 8 seems to not have that issue, so if downgrading is your option, you can do that for now.
Additionally, if that still doesn't help, disabling minimization in next.config.js will reduce memory usage:
module.exports = {
webpack: (config, options) => {
config.optimization.minimize = false;
return config
}
}
If you do not want to exclude minimization, I found out that with version 8 you can build your app locally and move already built folder to your shared hosting without having to run "next build" on shared hosting again. I couldn't do that with version 9.
Update: Tested on NextJs version 8.1
I am getting the following error:
npm ERR! missing script: start
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\..\AppData\Roaming\npm-cache\_logs\2019-04-27T18_02_39_6
60Z-debug.log
This is what I am doing -
In my package.json I have written the following code:
{
"name":"javaScript-blockchain",
"version":"1.0.0",
"description":"",
"main":"index.js",
"scripts": {
"test":"echo \"Error:no test specified\" && exit 1",
"start":"node dev/api.js"
}
"author":"Samrat Roy Chowdhuri",
"license":"ISC",
"dependencies":{
"express":"^4.16.3",
"nodemon":"^1.17.3",
"sha256":"^0.2.0"
}
}
Then in my Node prompt I run npm start and get the above error
In the log the following is mentioned:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start' ]
2 info using npm#6.4.1
3 info using node#v10.15.3
4 verbose stack Error: missing script: start
4 verbose stack at run (C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:155:19)
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:63:5
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:115:5
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:418:5
4 verbose stack at checkBinReferences_ (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:373:45)
4 verbose stack at final (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:416:3)
4 verbose stack at then (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:160:5)
4 verbose stack at ReadFileContext.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:332:20)
4 verbose stack at ReadFileContext.callback (C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:78:16)
4 verbose stack at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:237:13)
5 verbose cwd E:\programs\blockchain
6 verbose Windows_NT 6.1.7601
7 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
8 verbose node v10.15.3
9 verbose npm v6.4.1
10 error missing script: start
11 verbose exit [ 1, true ]
Please suggest where I am going wrong
Your JSON is invalid. you just need a comma after the script curly bracket which is just after the start script
{
"name":"javaScript-blockchain",
"version":"1.0.0",
"description":"",
"main":"index.js",
"scripts": {
"test":"echo \"Error:no test specified\" && exit 1",
"start":"node dev/api.js"
},
"author":"Samrat Roy Chowdhuri",
"license":"ISC",
"dependencies":{
"express":"^4.16.3",
"nodemon":"^1.17.3",
"sha256":"^0.2.0"
}
}
So I'm working on a React App using Webstorm for IDE. As far as I can tell everything seems to be configured properly, but somehow when I try to run the app it would throw an error "Failed to load resource: the server responded with a status of 404 (Not Found)".
Here is a sample of script in the index:
<script>
try {
Typekit.load({
async: true
});
} catch (e) {}
</script>
<script type="text/javascript" src="app/fonts/Numbers.js"></script>
<script src="/dist/app.bundle.js"></script>
...From server.js
const express = require('express');
const path = require('path');
const fs = require('fs');
const bodyParser = require('body-parser');
const app = express();
const renderIndex = function (req, res) {
console.warn(__dirname + '/app/' + 'index.tpl.html');
res.sendFile(path.join(__dirname, '/app/', 'index.tpl.html'));
};
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
app.use(express.static(path.join(__dirname, '/')));
app.listen(3000, function () {
console.log('Your app listening on port 3000!')
<p>
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/lib/node_modules/npm/bin/npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'start',
1 verbose cli '--scripts-prepend-node-path=auto' ]
2 info using npm#5.5.1
3 info using node#v9.2.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle webpack-react-redux#1.0.0~prestart: webpack-react-redux#1.0.0
6 info lifecycle webpack-react-redux#1.0.0~start: webpack-react-redux#1.0.0
7 verbose lifecycle webpack-react-redux#1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle webpack-react-redux#1.0.0~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/blkbox/Desktop/Chris'/Quantdir/quantum-express-server/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
9 verbose lifecycle webpack-react-redux#1.0.0~start: CWD: /Users/blkbox/Desktop/Chris'/Quantdir/quantum-express-server
10 silly lifecycle webpack-react-redux#1.0.0~start: Args: [ '-c', 'node server' ]
11 silly lifecycle webpack-react-redux#1.0.0~start: Returned: code: 1 signal: null
12 info lifecycle webpack-react-redux#1.0.0~start: Failed to exec start script
13 verbose stack Error: webpack-react-redux#1.0.0 start: `node server`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:280:16)
13 verbose stack at EventEmitter.emit (events.js:159:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:159:13)
13 verbose stack at maybeClose (internal/child_process.js:943:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
14 verbose pkgid webpack-react-redux#1.0.0
15 verbose cwd /Users/blkbox/Desktop/Chris'/Quantdir/quantum-express-server
16 verbose Darwin 14.5.0
17 verbose argv "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/bin/npm-cli.js" "run" "start" "--scripts-prepend-node-path=auto"
18 verbose node v9.2.0
19 verbose npm v5.5.1
</p>
What I want to accomplish is to have the app run in the browser, but continue getting an error. A response will be very much appreciated. Thanks.
Have you tried removing the first forward slash from the path
src='dist/app.bundle.js'
Are you able to confirm that the entry point path is indeed correct? "/dist/app.bundle.js"
Maybe you could add server route / which returns your index html
app.get('/',function (req, res) { res.sendFile(pathToYourHTML) })