Don Smythe
Don Smythe

Reputation: 9814

npm-debug.log not generated on error

According to the npm docs "On failure, all logs are written to npm-debug.log in the current working directory." however on build error I don't get a log file written. Current settings

$>npm config list

cwd = /home/me/mynodeapp
HOME = /home/me

$>npm config ls -l

loglevel = "warn"

webpack.config.js

var config = {
  loglevel: 'silly',
  entry: {
    app: './myapp/start.js'
  },
  output: {
    ...
  },
};
module.exports = config;

package.json

{
{ "name" : "myapp",
  "main": "start.js",
   "scripts": {
    "build": "rm -rf ./output/ && NODE_ENV=production node node_modules/.bin/webpack",
  },
  ...
}

then on npm run build I get an error:

ERROR in ./myapp/start.js
Module build failed: TypeError: ....

But no npm-debug.log file was generated in/home/me/mynodeapp (directory from which I can npm install and npm run build, and the cwd according to npm config). NB I am the owner of the directory and subdirectories and have write permission. Any ideas?

Upvotes: 1

Views: 3430

Answers (1)

matt
matt

Reputation: 1753

That's kinda strange why its not getting you an npm log. Maybe try something like this when you run your command: npm run build 2>&1 > npm_error_log.txt. This will output stderr and stdout to a file for easy reading.

Upvotes: 1

Related Questions