Start script missing error when running npm start

I’m receiving this error when trying to debug my node application using the npm start command. Error: npm ERR! Windows_NT 6.3.9600 npm ERR! argv “C:\\Program Files\\nodejs\\\\node.exe” “C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js” “start” npm ERR! node v0.12.7 npm ERR! npm v2.11.3 npm ERR! missing script: start npm ERR! npm ERR! If you need help, you may report this error … Read more

SyntaxError: Cannot use import statement outside a module

I’ve got an ApolloServer project that’s giving me trouble, so I thought I might update it and ran into issues when using the latest Babel. My “index.js” is: require(‘dotenv’).config() import {startServer} from ‘./server’ startServer() And when I run it I get the error SyntaxError: Cannot use import statement outside a module First I tried doing … Read more

How to set environment variables from within package.json?

How to set some environment variables from within package.json to be used with npm start like commands? Here’s what I currently have in my package.json: { … “scripts”: { “help”: “tagove help”, “start”: “tagove start” } … } I want to set environment variables (like NODE_ENV) in the start script while still being able to … Read more

Is there a way to get version from package.json in nodejs code?

Is there a way to get the version set in package.json in a nodejs app? I would want something like this var port = process.env.PORT || 3000 app.listen port console.log “Express server listening on port %d in %s mode %s”, app.address().port, app.settings.env, app.VERSION 27 s 27 I found that the following code fragment worked best … Read more

What’s the difference between dependencies, devDependencies and peerDependencies in npm package.json file?

This documentation answers my question very poorly. I didn’t understand those explanations. Can someone say in simpler words? Maybe with examples if it’s hard to choose simple words? EDIT also added peerDependencies, which is closely related and might cause confusion. 1 17 Summary of important behavior differences: dependencies are installed on both: npm install from … Read more

What’s the difference between tilde(~) and caret(^) in package.json?

After I upgraded to the latest stable node and npm, I tried npm install moment –save. It saves the entry in the package.json with the caret ^ prefix. Previously, it was a tilde ~ prefix. Why are these changes made in npm? What is the difference between tilde ~ and caret ^? What are the … Read more