I am trying to use firebase functions to send config to an Iot device.Here is the tutorial which i am trying to use.This is the Node js code which i am deploying
The tutorial says after, after deployment whatever change i will do to my firebase database it will get sent to the iot device as device config.
registryid is INTERNET_OF_BULBS.
Iot device name is Iot-device-1.
The actual code in the tutorial doesnt work for deployment.So I removed the import modules part and used require.
The tutorial does these imports.
import * as admin from "firebase-admin";
import * as functions from 'firebase-functions';
import { runInDebugContext } from 'vm';
import { DeviceManager } from './devices';
how do i import { DeviceManager } from './devices';
so i am doing only 2 imports.Otherwise ,if i use import in my index.js it gives error when deploying.
1:1 error Parsing error: 'import' and 'export' may appear only with 'sourceType: module'
Below is my index.js file.
const admin =require('firebase-admin');
const functions =require('firebase-functions');
admin.initializeApp();
// create a device manager instance with a registry id, optionally pass a region
const dm = new DeviceManager('INTERNET_OF_BULBS');
const firestore = admin.firestore();
// start cloud function
exports.configUpdate = functions.firestore
// assumes a document whose ID is the same as the deviceid
.document('device-configs/Iot-device-1')
.onWrite((change,context) => {
var beforeData = change.before.val(); // data before the write
var afterData = change.after.val();
if (context) {
await dm.setAuth();
console.log(context.params.deviceId);
// get the new config data
const configData = change.after.data();
return dm.updateConfig(context.params.deviceId, configData);
} else {
throw(Error("no context from trigger"));
}
})
Here is the error on my shell when i am trying to deploy,the above code.
firebase deploy
=== Deploying to 'wifi-lights-88783'...
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
> functions# lint /home/suposhmehta/fire/functions
> eslint .
/home/suposhmehta/fire/functions/index.js
17:13 error Parsing error: Unexpected token dm
✖ 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! /home/suposhmehta/.npm/_logs/2018-11-10T09_38_15_585Z-debug.log
Error: functions predeploy error: Command terminated with non-zero exit code1
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/nvm/versions/node/v8.9.4/bin/node',
1 verbose cli '/usr/local/nvm/versions/node/v8.9.4/bin/npm',
1 verbose cli '--prefix',
1 verbose cli '/home/suposhmehta/fire/functions',
1 verbose cli 'run',
1 verbose cli 'lint' ]
2 info using npm#5.6.0
3 info using node#v8.9.4
4 verbose run-script [ 'prelint', 'lint', 'postlint' ]
5 info lifecycle functions#~prelint: functions#
6 info lifecycle functions#~lint: functions#
7 verbose lifecycle functions#~lint: unsafe-perm in lifecycle true
8 verbose lifecycle functions#~lint: PATH: /usr/local/nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/suposhmehta/fire/functions/node_
modules/.bin:/home/suposhmehta/gopath/bin:/google/gopath/bin:/google/google-cloud-sdk/bin:/usr/local/go/bin:/opt/gradle/bin:/opt/maven/bin:/usr/local/sbin:/usr/local/bin:/usr/sbi
n:/usr/bin:/sbin:/bin:/usr/local/nvm/versions/node/v8.9.4/bin:/google/go_appengine:/google/google_appengine
9 verbose lifecycle functions#~lint: CWD: /home/suposhmehta/fire/functions
10 silly lifecycle functions#~lint: Args: [ '-c', 'eslint .' ]
11 silly lifecycle functions#~lint: Returned: code: 1 signal: null
12 info lifecycle functions#~lint: Failed to exec lint script
13 verbose stack Error: functions# lint: `eslint .`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid functions#
15 verbose cwd /home/suposhmehta/fire
16 verbose Linux 4.14.33+
17 verbose argv "/usr/local/nvm/versions/node/v8.9.4/bin/node" "/usr/local/nvm/versions/node/v8.9.4/bin/npm" "--prefix" "/home/suposhmehta/fire/functions" "run" "lint"
18 verbose node v8.9.4
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error functions# lint: `eslint .`
22 error Exit status 1
23 error Failed at the functions# lint script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
How do i get rid of these issues?
Please Help.
Related
I recently started to learn Next/React to make a personal website, I'm trying to build a website with Next.JS, the website looks and works fine when running npm run dev, however, it's giving me an error when I try to make a build of it. I don't really understand the error, and much less how to fix it.
Thanks
Terminal Log
> portfolio# build C:\Users\Simon\Desktop\#Documents\##Projects\Coding\#web\portfolio
> next build
info - Checking validity of types
./pages/blog/[slug].js
26:17 Warning: Do not include stylesheets manually. See: https://nextjs.org/docs/messages/no-css-tags. #next/next/no-css-tags
./pages/index.js
12:9 Warning: Do not include stylesheets manually. See: https://nextjs.org/docs/messages/no-css-tags. #next/next/no-css-tags
13:9 Warning: External synchronous scripts are forbidden. See: https://nextjs.org/docs/messages/no-sync-scripts. #next/next/no-sync-scripts
23:13 Warning: Do not use <img>. Use Image from 'next/image' instead. See https://nextjs.org/docs/messages/no-img-element. #next/next/no-img-element
./components/MDXComponents.js
4:1 Warning: Assign object to a variable before exporting as module default import/no-anonymous-default-export
info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
info - Creating an optimized production build ...events.js:292
throw er; // Unhandled 'error' event
^
Error: EPERM: operation not permitted, open 'C:\Users\Simon\Desktop\#Documents\##Projects\Coding\#web\portfolio\.next\trace'
Emitted 'error' event on WriteStream instance at:
at C:\Users\Simon\Desktop\#Documents\##Projects\Coding\#web\portfolio\node_modules\next\dist\compiled\#vercel\nft\index.js:1:287421
at C:\Users\Simon\Desktop\#Documents\##Projects\Coding\#web\portfolio\node_modules\next\dist\compiled\#vercel\nft\index.js:1:287860
at FSReqCallback.oncomplete (fs.js:171:23) {
errno: -4048,
code: 'EPERM',
syscall: 'open',
path: 'C:\\Users\\Simon\\Desktop\\#Documents\\##Projects\\Coding\\#web\\portfolio\\.next\\trace'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! portfolio# build: `next build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the portfolio# 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! C:\Users\Simon\AppData\Roaming\npm-cache\_logs\2021-11-13T12_14_00_615Z-debug.log
Log File
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Users\\Simon\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\Simon\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build'
1 verbose cli ]
2 info using npm#6.14.12
3 info using node#v14.16.1
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle portfolio#~prebuild: portfolio#
6 info lifecycle portfolio#~build: portfolio#
7 verbose lifecycle portfolio#~build: unsafe-perm in lifecycle true
8 verbose lifecycle portfolio#~build: PATH: // Path stuff //
9 verbose lifecycle portfolio#~build: CWD: C:\Users\Simon\Desktop\#Documents\##Projects\Coding\#web\portfolio
10 silly lifecycle portfolio#~build: Args: [ '/d /s /c', 'next build' ]
11 silly lifecycle portfolio#~build: Returned: code: 1 signal: null
12 info lifecycle portfolio#~build: Failed to exec build script
13 verbose stack Error: portfolio# build: `next build`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\Simon\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:315:20)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\Simon\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:315:20)
13 verbose stack at maybeClose (internal/child_process.js:1048:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid portfolio#
15 verbose cwd C:\Users\Simon\Desktop\#Documents\##Projects\Coding\#web\portfolio
16 verbose Windows_NT 10.0.19043
17 verbose argv "C:\\Users\\Simon\\nodejs\\node.exe" "C:\\Users\\Simon\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v14.16.1
19 verbose npm v6.14.12
20 error code ELIFECYCLE
21 error errno 1
22 error portfolio# build: `next build`
22 error Exit status 1
23 error Failed at the portfolio# build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
.eslintrc.json
{
"extends": "next"
}
**package.json**
{
"name": "portfolio",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"#fortawesome/fontawesome-svg-core": "^1.2.36",
"#fortawesome/free-brands-svg-icons": "^5.15.4",
"#fortawesome/free-solid-svg-icons": "^5.15.4",
"#fortawesome/react-fontawesome": "^0.1.16",
"date-fns": "^2.25.0",
"gray-matter": "^4.0.3",
"next": "12.0.3",
"next-mdx-remote": "^3.0.8",
"react": "17.0.2",
"react-dom": "17.0.2",
"sass": "^1.43.4"
},
"devDependencies": {
"eslint": "7.32.0",
"eslint-config-next": "12.0.3"
}
}
I have a debian 9 server with latest version of nodejs
I have a vuejs app when i want to build it npm run build, I have errors:
⠋ Building for production...
ERROR Failed to compile with 5 errors 12:42:13 PM
This relative module was not found:
* ../config in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/login.vue?vue&type=script&lang=js&, ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/signup.vue?vue&type=script&lang=js& and 3 others
ERROR Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! moveup-vuejs#0.1.0 build: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the moveup-vuejs#0.1.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! /root/.npm/_logs/2019-08-30T10_42_13_354Z-debug.log
This is the log it gives on error:
root#vps723374:/var/www/moveup-vuejs# cat /root/.npm/_logs/2019-08-30T10_58_13_481Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'build' ]
2 info using npm#6.9.0
3 info using node#v10.16.3
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle moveup-vuejs#0.1.0~prebuild: moveup-vuejs#0.1.0
6 info lifecycle moveup-vuejs#0.1.0~build: moveup-vuejs#0.1.0
7 verbose lifecycle moveup-vuejs#0.1.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle moveup-vuejs#0.1.0~build: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/var/www/moveup-vuejs/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
9 verbose lifecycle moveup-vuejs#0.1.0~build: CWD: /var/www/moveup-vuejs
10 silly lifecycle moveup-vuejs#0.1.0~build: Args: [ '-c', 'vue-cli-service build' ]
11 silly lifecycle moveup-vuejs#0.1.0~build: Returned: code: 1 signal: null
12 info lifecycle moveup-vuejs#0.1.0~build: Failed to exec build script
13 verbose stack Error: moveup-vuejs#0.1.0 build: `vue-cli-service build`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/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 moveup-vuejs#0.1.0
15 verbose cwd /var/www/moveup-vuejs
16 verbose Linux 4.9.0-9-amd64
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "build"
18 verbose node v10.16.3
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error moveup-vuejs#0.1.0 build: `vue-cli-service build`
22 error Exit status 1
23 error Failed at the moveup-vuejs#0.1.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 don' t know if it heps, when i do npm install i have warnings:
root#vps723374:/var/www/moveup-vuejs# npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
My vue.js
<template>
<div>
....
</div>
</template>
<script>
import axios from "axios";
import { ApiUrl } from "../config";
export default {
name: "signup",
data() {
return {
firstname: "",
lastname: "",
email: "",
password: "",
c_password: "",
};
},
methods: {
signup: function(e) {
e.preventDefault();
axios
.post(ApiUrl + "/signup", {
firstname: this.firstname,
lastname: this.lastname,
email: this.email,
password: this.password,
c_password: this.c_password,
})
.then(response => {
console.log(response.data.success.token);
this.$router.push("/login");
})
.catch(error => {
console.log(error);
});
}
}
};
</script>
What is strange is it build perfectly on another server.
I remove the nodejs install, reinstall it, try another version, ect without success, I m running out of idea, any idea where it' s coming from ?
Thanks
Seem to have this problem even if i reinstalled it, deleted node-modules/package-lock.json/ downgraded to a earlier version
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Users\\Shaimz\\Desktop\\work\\Programs\\node.exe',
1 verbose cli 'C:\\Users\\Shaimz\\Desktop\\work\\Programs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build' ]
2 info using npm#6.9.0
3 info using node#v10.16.3
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle my-app#1.0.0~prebuild: my-app#1.0.0
6 info lifecycle my-app#1.0.0~build: my-app#1.0.0
7 verbose lifecycle my-app#1.0.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle my-app#1.0.0~build: PATH: C:\Users\Shaimz\Desktop\work\Programs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Shaimz\Desktop\work\node\my-app\node_modules\.bin;C:\Python27\;C:\Python27\Scripts;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\AMD\ATI.ACE\Core-Static;C:\Program Files\010 Editor;C:\FPC\3.0.4\bin\i386-Win32;D:\Programs\Git\cmd;C:\ProgramData\chocolatey\bin;C:\Users\Shaimz\Desktop\work\Programs\;D:\Programs\Microsoft VS Code\bin;C:\Users\Shaimz\AppData\Local\GitHubDesktop\bin;C:\Users\Shaimz\AppData\Roaming\npm
9 verbose lifecycle my-app#1.0.0~build: CWD: C:\Users\Shaimz\Desktop\work\node\my-app
10 silly lifecycle my-app#1.0.0~build: Args: [ '/d /s /c', 'webpack' ]
11 silly lifecycle my-app#1.0.0~build: Returned: code: 1 signal: null
12 info lifecycle my-app#1.0.0~build: Failed to exec build script
13 verbose stack Error: my-app#1.0.0 build: `webpack`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\Shaimz\Desktop\work\Programs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\Shaimz\Desktop\work\Programs\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 my-app#1.0.0
15 verbose cwd C:\Users\Shaimz\Desktop\work\node\my-app
16 verbose Windows_NT 6.1.7601
17 verbose argv "C:\\Users\\Shaimz\\Desktop\\work\\Programs\\node.exe" "C:\\Users\\Shaimz\\Desktop\\work\\Programs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v10.16.3
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error my-app#1.0.0 build: `webpack`
22 error Exit status 1
23 error Failed at the my-app#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 ]
WEBPACK config right here :
var React = require('react');
var ReactDOM = require('react-dom');
var App = require('./components/App');
ReactDOM.render(
<App/>,
document.getElementById('app')
);
var HTMLWebpackPlugin = require('html-webpack-plugin');
var HTMLWebpackPluginConfig = new HTMLWebpackPlugin({
template: __dirname + '/app/index.html',
filename:'index.html',
inject:'head'
});
module.exports = {
entry: ['./app/index.js'],
module:{
loaders:[
{
test: /\.js$/,
exclude: /node_modules/,
loader:'babel-loader'
}
]
},
output:{
path:__dirname + '/build',
filename:'file.js'
},
plugins:[HTMLWebpackPluginConfig]
};
I think that's the formated code , sorry , i'm new to stackoverflow.I wish you could help me with that problem , i was starting to think maybe i do something wrong but i dont think soo , i was watching carefully a guide on codecademy
Whenever I try building my web-pack file or starting web-pack dev server I get an error. It was working, but I was messing around with eslint and broke something.
This is the error package when trying npm build
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using npm#4.5.0
3 info using node#v6.10.3
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle setup#1.0.0~prebuild: setup#1.0.0
6 silly lifecycle setup#1.0.0~prebuild: no script for prebuild, continuing
7 info lifecycle setup#1.0.0~build: setup#1.0.0
8 verbose lifecycle setup#1.0.0~build: unsafe-perm in lifecycle true
9 verbose lifecycle setup#1.0.0~build: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/Nims/Documents/Web Development/Projects/React bookstore/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
10 verbose lifecycle setup#1.0.0~build: CWD: /Users/Nims/Documents/Web Development/Projects/React bookstore
11 silly lifecycle setup#1.0.0~build: Args: [ '-c', 'webpack' ]
12 silly lifecycle setup#1.0.0~build: Returned: code: 1 signal: null
13 info lifecycle setup#1.0.0~build: Failed to exec build script
14 verbose stack Error: setup#1.0.0 build: `webpack`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:279: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> (/usr/local/lib/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:886:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid setup#1.0.0
16 verbose cwd /Users/Nims/Documents/Web Development/Projects/React bookstore
17 verbose Darwin 16.5.0
18 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
19 verbose node v6.10.3
20 verbose npm v4.5.0
21 error code ELIFECYCLE
22 error errno 1
23 error setup#1.0.0 build: `webpack`
23 error Exit status 1
24 error Failed at the setup#1.0.0 build script 'webpack'.
24 error Make sure you have the latest version of node.js and npm installed.
24 error If you do, this is most likely a problem with the setup package,
24 error not with npm itself.
24 error Tell the author that this fails on your system:
24 error webpack
24 error You can get information on how to open an issue for this project with:
24 error npm bugs setup
24 error Or if that isn't available, you can get their info via:
24 error npm owner ls setup
24 error There is likely additional logging output above.
25 verbose exit [ 1, true ]
and when trying npm start
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#4.5.0
3 info using node#v6.10.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle setup#1.0.0~prestart: setup#1.0.0
6 silly lifecycle setup#1.0.0~prestart: no script for prestart, continuing
7 info lifecycle setup#1.0.0~start: setup#1.0.0
8 verbose lifecycle setup#1.0.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle setup#1.0.0~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/Nims/Documents/Web Development/Projects/React bookstore/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
10 verbose lifecycle setup#1.0.0~start: CWD: /Users/Nims/Documents/Web Development/Projects/React bookstore
11 silly lifecycle setup#1.0.0~start: Args: [ '-c', 'webpack-dev-server' ]
12 silly lifecycle setup#1.0.0~start: Returned: code: 1 signal: null
13 info lifecycle setup#1.0.0~start: Failed to exec start script
14 verbose stack Error: setup#1.0.0 start: `webpack-dev-server`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:279: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> (/usr/local/lib/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:886:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid setup#1.0.0
16 verbose cwd /Users/Nims/Documents/Web Development/Projects/React bookstore
17 verbose Darwin 16.5.0
18 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
19 verbose node v6.10.3
20 verbose npm v4.5.0
21 error code ELIFECYCLE
22 error errno 1
23 error setup#1.0.0 start: `webpack-dev-server`
23 error Exit status 1
24 error Failed at the setup#1.0.0 start script 'webpack-dev-server'.
24 error Make sure you have the latest version of node.js and npm installed.
24 error If you do, this is most likely a problem with the setup package,
24 error not with npm itself.
24 error Tell the author that this fails on your system:
24 error webpack-dev-server
24 error You can get information on how to open an issue for this project with:
24 error npm bugs setup
24 error Or if that isn't available, you can get their info via:
24 error npm owner ls setup
24 error There is likely additional logging output above.
25 verbose exit [ 1, true ]
Here is my webpack file
module.exports = {
entry: ['babel-polyfill', './app/index.js'],
output: {
path: __dirname + '/build',
// if the above line does not work, try `path: __dirname + '/build'`
filename: 'bundle.js'
},
module: {
loaders: [
{
test: /\.js$/, // a regular expression that catches .js files
exclude: /node_modules/,
loader: ['babel-loader']
}
],
},
devServer: {
port: 3000, // most common port
contentBase: './build',
inline: true
}
};
It seems its not picking up the local scripts in my webpack.config.js file - but I'm new to this and I'm still learning
Try deleting the node_modules, and then run the script.
May not have been installed in npm global and then install them separately and then run the regular npm install without root privileges:
sudo npm install -g coffee-script node-gyp
npm install
i start server success but client connect it have error
https://jsfiddle.net/m9wvm4nu/3/ (in css is file debuglog)
here is file debuglog if u dont need my code in node . I dont know what happening
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\nodejs\\node.exe',
1 verbose cli 'C:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start' ]
2 info using npm#3.3.12
3 info using node#v5.1.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle simple-website#1.0.0~prestart: simple-website#1.0.0
6 silly lifecycle simple-website#1.0.0~prestart: no script for prestart, continuing
7 info lifecycle simple-website#1.0.0~start: simple-website#1.0.0
8 verbose lifecycle simple-website#1.0.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle simple-website#1.0.0~start: PATH: C:\nodejs\node_modules\npm\bin\node-gyp-bin;D:\1-PROJECT\simple-website\node_modules\.bin;C:\Users\MyPC\bin;C:\Users\MyPC\AppData\Local\Programs\Git\mingw64\bin;C:\Users\MyPC\AppData\Local\Programs\Git\usr\local\bin;C:\Users\MyPC\AppData\Local\Programs\Git\usr\bin;C:\Users\MyPC\AppData\Local\Programs\Git\usr\bin;C:\Users\MyPC\AppData\Local\Programs\Git\mingw64\bin;C:\Users\MyPC\AppData\Local\Programs\Git\usr\bin;C:\Users\MyPC\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Skype\Phone;C:\nodejs;C:\Users\MyPC\AppData\Local\atom\bin;C:\Users\MyPC\AppData\Local\.meteor;C:\Users\MyPC\AppData\Roaming\npm;C:\Users\MyPC\AppData\Local\Programs\Git\cmd;C:\Users\MyPC\AppData\Local\Programs\Git\mingw64\bin;C:\Users\MyPC\AppData\Local\Programs\Git\usr\bin;C:\Users\MyPC\AppData\Local\Programs\Git\usr\bin\vendor_perl;C:\Users\MyPC\AppData\Local\Programs\Git\usr\bin\core_perl
10 verbose lifecycle simple-website#1.0.0~start: CWD: D:\1-PROJECT\simple-website
11 silly lifecycle simple-website#1.0.0~start: Args: [ '/d /s /c', 'node server.js' ]
12 silly lifecycle simple-website#1.0.0~start: Returned: code: 1 signal: null
13 info lifecycle simple-website#1.0.0~start: Failed to exec start script
14 verbose stack Error: simple-website#1.0.0 start: `node server.js`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (C:\nodejs\node_modules\npm\lib\utils\lifecycle.js:232:16)
14 verbose stack at emitTwo (events.js:87:13)
14 verbose stack at EventEmitter.emit (events.js:172:7)
14 verbose stack at ChildProcess.<anonymous> (C:\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
14 verbose stack at emitTwo (events.js:87:13)
14 verbose stack at ChildProcess.emit (events.js:172:7)
14 verbose stack at maybeClose (internal/child_process.js:818:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
15 verbose pkgid simple-website#1.0.0
16 verbose cwd D:\1-PROJECT\simple-website
17 error Windows_NT 10.0.10240
18 error argv "C:\\nodejs\\node.exe" "C:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
19 error node v5.1.0
20 error npm v3.3.12
21 error code ELIFECYCLE
22 error simple-website#1.0.0 start: `node server.js`
22 error Exit status 1
23 error Failed at the simple-website#1.0.0 start script 'node server.js'.
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 simple-website package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error node server.js
23 error You can get their info via:
23 error npm owner ls simple-website
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
I'm not sure exactly what is causing your specific error, but this is a problem in your script:
var mineType = mineType[path.extname(fileName).split(".").reverse()[0]];
res.writeHead(200, {'content-Type': mineType});
You can't use the same variable name for your mineType table and for a local variable. Change the local variable to a different variable name:
var type = mineType[path.extname(fileName).split(".").reverse()[0]];
res.writeHead(200, {'content-Type': type});