How to fix error "npm ERR! missing script: start" - javascript

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"
}
}

Related

Issues with react and react-dom dependencies

I am starting to learn ReactJS. I have node installed on my computer. I am writing a basic "Hello World" Programming to see if my setup is alright.
The package.json file is:
{
"name": "part1",
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"react": "^16.13.1",
"react-dom": "^16.13.1"
}
}
The Javascript and HTML files are as follows-
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Part1</title>
<link href="style.css" rel="stylesheet">
</head>
<body>
<div id="root">
</div>
<script src="index.js" ></script>
</body>
</html>
Javascript
import React from "react";
import ReactDOM from "react-dom";
ReactDOM.render(<h1>"Hello world"</h1>,document.getElementById("root"));
However when i run this on the html file on the browser I get an error in the console as:
Uncaught SyntaxError: Cannot use import statement outside a module
and no output is displayed.
I am using VSCode and when i run the script using inbuilt run, i get an error that states that To run ES add type:module in package.json which i understand since the inbuilt run probably runs on node but why is this issue there on the browser and live server also?
Is this a setup issue or a semantic issue or any other technical issue. How do I resolve this?
When I am running using npm start the following is the error log-
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using npm#6.14.6
3 info using node#v12.18.3
4 verbose stack Error: missing script: start
4 verbose stack at run (/usr/local/lib/node_modules/npm/lib/run-script.js:155:19)
4 verbose stack at /usr/local/lib/node_modules/npm/lib/run-script.js:63:5
4 verbose stack at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:116:5
4 verbose stack at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:436:5
4 verbose stack at checkBinReferences_ (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:391:45)
4 verbose stack at final (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:434:3)
4 verbose stack at then (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:161:5)
4 verbose stack at ReadFileContext.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:350:20)
4 verbose stack at ReadFileContext.callback (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:123:16)
4 verbose stack at FSReqCallback.readFileAfterOpen [as oncomplete] (fs.js:261:13)
5 verbose cwd /Users/pk/Desktop/Learning-react/part1
6 verbose Darwin 19.3.0
7 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
8 verbose node v12.18.3
9 verbose npm v6.14.6
10 error missing script: start
11 verbose exit [ 1, true ]
Ciao, try to change your index.html file like this:
<div id="root"></div>
And everything should work.
Check this example.

Can you help me to solve this error about json?

I'm trying to connect Firebase using node.js
I have following code in my json file.
const functions = require('firebase-functions');
const hmac_sha256= require ('crypto-js/hmac_sha256');
const request= require('request');
const admin= require('firebase-admin');
const service_Account= require('./service_account_key.json');
const firebaseConfig= json.parse(process.env.FIREBASE_CONFIG);
firebaseConfig.credential= admin.credential.cert("service_Account");
admin.initializeApp(firebaseConfig);
exports.getCustomToken = functions.https.onRequest((req,res)=>{
const accessToken= req.query.access_Token;
const FacebookAppSec= '72100b8d4ee21a85fc67d014f3b0c9fa';
const AppSecretProof= hmac_sha256(accessToken,FacebookAppSec);
//Validate token...
const uri='https://graph.accountkit.com/v1.1/me?access_Token=${accessToken}&App_Proof=${AppSecretProof}';
request({
url= uri,
json:true
},(error,fbresponse,data)=>{
if(error)
{
console.error('Access Token validation request failed\n',error);
res.status(400).send(error);
}
else if(data.error)
{
console.error('Invalid Access Token\n',
'access_Token=${accessToken}',
'App_Proof=${AppSecretProof}',data.error);
res.status(400).send(data);
}
else
{
admin.auth().createCustomToken(data.id)
.then(CustomToken => res.status(200).send(CustomToken))
.catch(error => {
console.error('Create Custom Token Failed.',error);
res.status(400).send(error);
})
}
})
})
After using command-firebase deploy I got this
> G:\New folder\firebase_functions>firebase deploy
=== Deploying to 'eatitv2-8aa15'...
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
> functions# lint G:\New folder\firebase_functions\functions
> eslint .
G:\New folder\firebase_functions\functions\index.js
19:9 error Parsing error: Shorthand property assignments are valid only in destructuring patterns
✖ 1 problem (1 error, 0 warnings)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions# lint: `eslint .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the functions# lint 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\Maaz Farooq\AppData\Roaming\npm-cache\_logs\2020-07-18T16_58_24_083Z-debug.log
events.js:292
throw er; // Unhandled 'error' event
^
Error: spawn npm --prefix "%RESOURCE_DIR%" run lint ENOENT
at notFoundError (C:\Users\Maaz Farooq\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:6:26)
at verifyENOENT (C:\Users\Maaz Farooq\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:40:16)
at ChildProcess.cp.emit (C:\Users\Maaz Farooq\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:27:25)
at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess.cp.emit (C:\Users\Maaz Farooq\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:30:37)
at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12) {
code: 'ENOENT',
errno: 'ENOENT',
syscall: 'spawn npm --prefix "%RESOURCE_DIR%" run lint',
path: 'npm --prefix "%RESOURCE_DIR%" run lint',
spawnargs: []
}
Error: functions predeploy error: Command terminated with non-zero exit code1
I see many answers on stack overflow as well as on github, but nothing proceed. i have tried my best to solve it by myown also get help from online community but now posting this to all of you.
The output shows that ESLint is giving you this error message on line 19 of index.js:
19:9 error Parsing error: Shorthand property assignments are valid only in destructuring patterns
Line 19 is url= uri below:
request({
url= uri,
json:true
},(error,fbresponse,data)=>{
If you want to give values to properties in a JavaScript objects, you have to use : instead of =, just like you did with json:true.
request({
url: uri,
json:true
},(error,fbresponse,data)=>{

Next JS build failed on shared hosting

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 keep getting "Failed to load resource" when I try to start an React app

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) })

Webpack npm-debug.log file issue

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.

Categories

Resources