Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

216
Views
Node Package Manager Failing on Browserify Script

There are lots of moving parts for this question so I will post everything. I am running npm run build and I get the following:

enter image description here

Here is my build script in package.json file:

"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build":"browserify -d app/scripts/src/main.js -o app/scripts/dist/main.js" 
  },
  "browserify":{
    "transform":[
      "babelify",{"presets":["es2015"],"sourceMap":true}
    ]
  },

app.js:

class ChatApp {
  constructor() {
    console.log("Hello World")
  }
}
 export default ChatApp 

main.js:

import ChatApp from './app'
new ChatApp()

Node version: 6.9.4

Browserify version: 14.3.0

UPDATE:

I updated it and still same result.

  "build":"browserify app/scripts/src/main.js -d -o app/scripts/dist/main.js"

This also does not work and gives the same error:

"build":"browserify app/scripts/src/main.js > app/scripts/dist/main.js -d -o"

Also this same result:

"build":"browserify app/scripts/src/main.js > app/scripts/dist/main.js"

UPDATE: Running only the Browserify command from terminal

browserify app/scripts/src/main.js app/scripts/dist/main.js -d -o 
TypeError: Path must be a string.
    at resolve (/usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:15:19)
    at nr (/usr/local/lib/node_modules/browserify/node_modules/module-deps/index.js:282:24)
    at /usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:17:13
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I was able to reproduce your error and fixed it by changing the browserify section of your package.json file (note how there's a nested array).

{
  "scripts": {
    "build": "browserify -d app/scripts/src/main.js -o app/scripts/dist/main.js"
  },
  "browserify": {
    "transform": [ [  "babelify", { "presets": [ "es2015" ], "sourceMap": true } ] ]
  },
  "dependencies": {
    "babel-preset-es2015": "^6.24.1",
    "babelify": "^7.3.0"
  }
}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!