-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webpack fails on npm run start #190
Comments
I had the same issue earlier this week. It seems like there was something wrong with the distribution package. I was able to fix this by cloning this library to a different location, going into the packages/dscc-scripts directory and running the build command. You can then point all of the scripts from the package.json dscc-gen made to the packages/dscc-scripts/index.js file. Bit of a hack, but good for the quick fix. |
Thanks for the heads up. I ended up doing what you described and then copying the new Anyway, the fix seems to be to update the `viz/util.js' file with the below code.
|
* Add DSCC_IS_LOCAL webpack definition. * Initial implementation of viz pack support. * Add option to run specific viz from viz pack locally. * fixed broken tests. * removed support for legacy configs and give more specific error to which component is misconfigured. * Added in componentName support to start script. * change path for manifest. * Update webpack configs to now show undefined. * make these only long-form args. * ran prettier. * Fixed unreachable exception to be the most common case. Co-authored-by: Brandon Garling <[email protected]>
Link to breaking change commit |
By only updating the 'util.js' file I get this error. modules@google\dscc-scripts\build\viz\util.js:100 Error: Your package.json must have a dsccViz.components[0].jsonFile entry: npm ERR! A complete log of this run can be found in: |
@nilupaadl |
@mattkizaric-leveragelab |
⬆️ on the thread. Is there a fix/workaround available? |
I'm also having this issue. Copying this code to I discovered the utils fix along with an apparently outdated package.json schema in the template were causing the new issue. By reverting
I found my package.json included a {
"dsccViz": {
"gcsDevBucket": "gs://dm-pop-up-list-visualization/dev",
"gcsProdBucket": "gs://dm-pop-up-list-visualization/prod",
"components": [
{
"jsFile": "index.js",
"jsonFile": "index.json",
"cssFile": "index.css"
}
]
},
"scripts": {
"build:dev": "dscc-scripts viz build -d dev",
"build:prod": "dscc-scripts viz build -d prod",
"push:dev": "dscc-scripts viz push -d dev",
"push:prod": "dscc-scripts viz push -d prod",
"update_message": "dscc-scripts viz update_message -f object",
"start": "dscc-scripts viz start"
},
"devDependencies": {
"@google/dscc": "^0.3.17",
"@google/dscc-scripts": "^1.0.17",
"copy-webpack-plugin": "^4.6.0"
}
} I changed it to this instead: {
"dsccViz": {
"gcsDevBucket": "gs://dm-pop-up-list-visualization/dev",
"gcsProdBucket": "gs://dm-pop-up-list-visualization/prod",
"jsFile": "index.js",
"jsonFile": "index.json",
"cssFile": "index.css"
},
"scripts": {
"build:dev": "dscc-scripts viz build -d dev",
"build:prod": "dscc-scripts viz build -d prod",
"push:dev": "dscc-scripts viz push -d dev",
"push:prod": "dscc-scripts viz push -d prod",
"update_message": "dscc-scripts viz update_message -f object",
"start": "dscc-scripts viz start"
},
"devDependencies": {
"@google/dscc": "^0.3.17",
"@google/dscc-scripts": "^1.0.17",
"copy-webpack-plugin": "^4.6.0"
}
} and |
Workaround: use Since the issue was introduced with the latest release # create a new project with the previous version of `dscc-gen`
npx @google/[email protected] viz Then move your |
Why not just use the version listed instead of also moving the files around? I got around by just using this version number suggested by @EonYang |
You're right. I was worried about dependency conflicts but seems like yarn and npm are smart enough to resolve it nicely. |
I used the [email protected]
node:internal/validators:129 TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined |
I tried all the ideas in this post and none worked. Did someone solve it? |
I found a solution. Then if you go to This will solve the first problem: Now you will get this error:
To solve this error go to Line 97 to 115:
The problem was with |
I was able to get a workaround to run all dscc-gen scripts ( First, follow the steps by @taljuk01 in the post above:
This will get If you attempt to run update_message or build you might get an error like this:
In
Define your dev and prod buckets instead of using the environment variables
Now you might also encounter this error if you try to run build or update_message:
In This can just be done below line 24 at the start of the buildOptions function
Reassign them with their values directly (ex.
Now we can do the same in
Reassign them the same way you did previously in build.js
Now all of the commands for dscc-gen should work! May be a short term option until a fix is implemented. |
Can't believe this is not receiving enough attention. The work arounds seem like so much work! |
Hi guys, I've just took the function code which is present here in the comments, and put it directly inside my webpack.config.js and it worked. No need to modify node_modules as this is not the right way to do it if you think about deploys in CD/CI or you re-install with clean. |
Ditto @ibraelillo Double ditto @monishwhisper !! I hope there aren't too many people having this problem. It's pretty discouraging when you're trying to get work done and a first-party library is busted. Also, there are people copy/pasting into Here's some more copypasta for someone looking for something small and useful for local development. It doesn't fix the [ line 5 ]
// Get outta here!!
// const {getBuildableComponents} = require('@google/dscc-scripts/build/viz/util');
const getBuildableComponents = () => {
const packageJson = JSON.parse(fs.readFileSync("package.json", "utf-8"));
if (!("dsccViz" in packageJson)) {
throw new Error(`missing "dsccViz" in package.json`);
}
if (!("components" in packageJson.dsccViz)) {
throw new Error(`missing "dsccViz.components" in package.json`);
}
const { components } = packageJson.dsccViz;
if (components.length === 0) {
throw new Error("no components to build");
}
if (typeof components[0].jsFile != "string") {
throw new Error("no components.jsFile to build");
}
return components;
}; |
There is one more bug to resolve in
}; |
Can you share how did you do it for webpack.config.js? |
That's just incredible, hope this issue will be fix soon |
From what I can tell, the code in the repo is OK, it's just that someone needs to publish a new version of dscc-scripts to npm. I was able to work around this issue by (these are from memory, may need to fiddle with this):
As far as I can tell, all this did was replace the dscc-scripts in my node_modules (v1.0.17) with the latest code from github. So I think we just need a new version published to npm to resolve this issue. @diminishedprime sorry if you're not the right person to bug for this, but does this sound right? |
Adding my +1 to this - It's now mid Sept & I've tried a couple of suggested solutions without luck, but there are now so many solutions put forward above (not all of them work for most people), it's hard to know how much time to spend trashing my set-up, or just give up the idea of creating a community data viz completely. It's a little bit demoralising. Is there any chance updated tooling is coming sometime soon? |
@diminishedprime Could you take a look at this issue, please? |
is there any possibility that this bug will be fixed soon? I would really like using this feature |
This seems crazy - has no one been able to create community visualizations since Nov 2020 (a year ago at this point)? There are other issues against this github repo from 2021, so how are those people getting the tools to run? There must be some other way of building and testing community viz if these tools don't run? Most of the above cut/pastes and hacks around no longer work (eg, Webpack seems to have changed it's import syntax) or are half documented. I'm running a 64bit Intel Mac. Is it possible it's a Mac only problem and this runs on Linux? Either I'm missing something or I'm taking crazy pills. Anyone know of an alternative route to getting community viz tools working? Help! (apologies for the direct callout) @diminishedprime @anweshan @y3l2n |
@pixelthing It looks like the instructions using dscc-gen are what you are having issues with, the more common way of getting community viz tools to run is to use the dscc library directly following the instructions here: |
In fact using :
works ! If you use all in latest version, it fails @diminishedprime or @anweshan : could we have the correct environment configuration to use at least the last version of dscc-gen correctly please ? |
well, almost 2 years, still broken. nice. tried to read the code : there are many references to environment variables, but NOTHING declares those variables (except in the test code). That's absurd coding (since there is a conf file for not having environment variables), absurd documentation ... etc. I simply can't get this thing to work, even with all intel here. edit : if anyone is interested, I managed to get things to work OK, but maybe not in a production-level-quality (I discovered npm here. And hated it right away when trying unsuccessfully to use the link/install commands). |
Looks like they fixed issue here. However, it was after https://github.com/googledatastudio/tooling/commits/main/packages/dscc-scripts https://www.npmjs.com/package/@google/dscc-scripts So, I just created my own repo and it works with updating package.json as.
|
Surprised that this has been open for years... Hoping this should be fixed, I filed a bug at https://issuetracker.google.com/issues/301488776. I don't expect a quick resolution as this tool looks heavily deprioritized... :( |
OK, it seems I found a workaround for live editing that covers new errors not mentioned above.
I know this is nasty -- the last change cannot be tracked by Git. :( A cleaner solution would be updating those versions in the original reporitories (which I don't expect to occur sometime soon). |
Solution by @eplusx works very well for running locally. If you want to build & deploy follow this steps. replace following environment variables with your file names
|
Thanks, guys, for all the instructions! I would have been pretty much stuck without it. I just needed to make a small change to our visualization, didn't expect the setup to be so hands-on :D |
When following the instructions here
I get the following error when trying to run locally (
npm run start
).The text was updated successfully, but these errors were encountered: