lasso-js / lasso

Advanced JavaScript module bundler, asset pipeline and optimizer
582 stars 75 forks source link

"path should be a string" error #243

Open bohdyone opened 6 years ago

bohdyone commented 6 years ago

Hi,

The very first thing when I try to use lasso-cli as per the examples is that I get a fatal error, and I can't continue. Even using the simplest use cases.

No idea what's going on here. test.js just consists of:

var c = require('change-case');

Big fat error is:

Bogdans-MacBook-Pro:Tabber boggers$ pwd
/Users/boggers/Google Drive/Code/Tabber
Bogdans-MacBook-Pro:Tabber boggers$ lasso --main test.js
Config:
{
    "outputDir": "/Users/boggers/Google Drive/Code/Tabber/static",
    "urlPrefix": "%STATIC_PATH%",
    "fingerprintsEnabled": false
}

Optimizing page "test"...
Failed to lasso page "test"! Reason: Error: Failed to walk dependency [require: /Users/boggers/Google Drive/Code/Tabber/test.js]. Dependency chain: [require: /Users/boggers/Google Drive/Code/Tabber/test.js]. Cause: AssertionError [ERR_ASSERTION]: path should be a string
    at module.exports (/usr/local/lib/node_modules/lasso-cli/node_modules/lasso/node_modules/raptor-util/createError.js:7:50)
    at AsyncValue.<anonymous> (/usr/local/lib/node_modules/lasso-cli/node_modules/lasso/lib/dependency-walker.js:141:48)
    at notifyCallbacks (/usr/local/lib/node_modules/lasso-cli/node_modules/raptor-async/AsyncValue.js:76:35)
    at AsyncValue.reject (/usr/local/lib/node_modules/lasso-cli/node_modules/raptor-async/AsyncValue.js:240:9)
    at getDependenciesCallback (/usr/local/lib/node_modules/lasso-cli/node_modules/lasso/lib/dependencies/Dependency.js:373:47)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
Caused by: AssertionError [ERR_ASSERTION]: path should be a string
    at getClientPath (/usr/local/lib/node_modules/lasso-cli/node_modules/lasso-modules-client/transport/src/getClientPath.js:11:5)
    at handleMetaInstalled (/usr/local/lib/node_modules/lasso-cli/node_modules/lasso-require/src/dep-require.js:113:40)
    at handleMeta (/usr/local/lib/node_modules/lasso-cli/node_modules/lasso-require/src/dep-require.js:186:21)
    at /usr/local/lib/node_modules/lasso-cli/node_modules/lasso-require/src/dep-require.js:494:33
    at Array.forEach (<anonymous>)
    at requireHandler.init.then.then.then (/usr/local/lib/node_modules/lasso-cli/node_modules/lasso-require/src/dep-require.js:489:34)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
------------------------------------
1 page(s) failed to build
bohdyone commented 6 years ago

Actually, I found out what it was; I never did an npm init!

Still, I think the error should probably be a bit more user friendly :)