You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I installed a Next project with the bundle analyzer, I'm trying to run the build analyzer with the following but I get an error.
PS D:\Personal\BayswaterPC\Code\bayswaterpc-superplate-blog> yarn build:analyze
yarn run v1.22.10
$ ANALYZE=true npm run build
'ANALYZE' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
PS D:\Personal\BayswaterPC\Code\bayswaterpc-superplate-blog>
npm run build:analyze also fails with a similar message about ANALYZE.
I noticed that the next config file wasn't configured per the bundle analyze documentation. It was just the following two lines
The next.config.js file now looks like the following, but I'm still getting the same issue unfortunately
constwithPlugins=require('next-compose-plugins')constwithBundleAnalyzer=require('@next/bundle-analyzer')({enabled: process.env.ANALYZE==='true',})module.exports=withPlugins([[withBundleAnalyzer],// your other plugins here])
Found the solution in this stack overflow thread, it may be a windows specific issue. Specifically performing the pwershell command from this fixed it.
I had this issue for a long time too. (webpack installed globally etc. but still not recognized) It turned out that I haven't specified enviroment variable for npm (where is file webpack.cmd sitting) So I add to my Path variable
%USERPROFILE%\AppData\Roaming\npm\
If you are using Powershell, you can type the following command to effectively add to your path :
[Environment]::SetEnvironmentVariable("Path", "$env:Path;%USERPROFILE%\AppData\Roaming\npm\", "User")
IMPORTANT : Don't forget to close and re-open your powershell window in order to apply this
I installed a Next project with the bundle analyzer, I'm trying to run the build analyzer with the following but I get an error.
npm run build:analyze
also fails with a similar message about ANALYZE.I noticed that the next config file wasn't configured per the bundle analyze documentation. It was just the following two lines
The next.config.js file now looks like the following, but I'm still getting the same issue unfortunately
Full code and project can be seen here. Thanks!
The text was updated successfully, but these errors were encountered: