How to build a un-minified version of Shopware 6 administration scripts for debugging purpose? - debugging

I would like to debug the following not-very-helpful error message when trying to save a custom CMS component in Shopware 6 administration layout editor:
An error was captured in current module: undefined
errorCaptured # app.js?16504701226454027:1
Xe # vendors-node.js?16504701221582962:2
(anonymous) # vendors-node.js?16504701221582962:2
Promise.catch (async)
Ge # vendors-node.js?16504701221582962:2
n # vendors-node.js?16504701221582962:2
o._wrapper # vendors-node.js?16504701221582962:2
When having such problems in the store front, I usually modify build-storefront.sh to call
npm --prefix "${STOREFRONT_ROOT}"/Resources/app/storefront run development
instead of
npm --prefix "${STOREFRONT_ROOT}"/Resources/app/storefront run production
Now I want to adapt build-administration.sh in a similar way:
The original line is
(cd "${ADMIN_ROOT}"/Resources/app/administration && npm clean-install && npm run build)
When I change it to
(cd "${ADMIN_ROOT}"/Resources/app/administration && npm install && mode=development npm run dev)
I would call
"dev": "mode=development webpack-dev-server",
vendor/shopware/administration/Resources/app/administration/package.json
I do not want to use the dev server and changed this to
"dev": "mode=development webpack",
No the build runs, but I still get a minified app.js as a result.
How can I debug the initial problem further?

Related

How to fix EACCES: permission denied, open '/Users/.... when installing gatsby-cli

I'm setting up Gatsby and get stuck at the beginning.
When i write npx/npm install global gatsby-cli in the terminal -
Alems-MacBook-Pro:~ alemkahrobek$ npm install -g gatsby-cli i see this:
/usr/local/bin/gatsby -> /usr/local/lib/node_modules/gatsby-cli/lib/index.js
gatsby-telemetry#1.0.4 postinstall /usr/local/lib/node_modules/gatsby-cli/node_modules/gatsby-telemetry
node src/postinstall.js
gatsby-cli#2.5.4
added 225 packages from 131 contributors in 13.617s.
If i check the version of gatsby i get this:
Alems-MacBook-Pro:~ alemkahrobek$ gatsby -v
/usr/local/lib/node_modules/gatsby-cli/node_modules/configstore/index.js:49
throw error;
^
Error: EACCES: permission denied, open '/Users/alemkahrobek/.config/gatsby/config.json'
You don't have access to this file.
at Object.openSync (fs.js:439:3)
at Object.readFileSync (fs.js:344:35)
at Configstore.get all [as all] (/usr/local/lib/node_modules/gatsby-cli/node_modules/configstore/index.js:31:25)
at new Configstore (/usr/local/lib/node_modules/gatsby-cli/node_modules/configstore/index.js:25:48)
at new Store (/usr/local/lib/node_modules/gatsby-cli/node_modules/gatsby-telemetry/lib/store.js:28:51)
at new EventStorage (/usr/local/lib/node_modules/gatsby-cli/node_modules/gatsby-telemetry/lib/event-storage.js:24:50)
at new AnalyticsTracker (/usr/local/lib/node_modules/gatsby-cli/node_modules/gatsby-telemetry/lib/telemetry.js:32:50)
at Object.<anonymous> (/usr/local/lib/node_modules/gatsby-cli/node_modules/gatsby-telemetry/lib/index.js:7:18)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10).
Now if i try to make a new project like:
gatsby new example
i get this:
Alems-MacBook-Pro:~ alemkahrobek$ npm gatsby new example
Usage: npm <command>
where <command> is one of:
access, adduser, audit, bin, bugs, c, cache, ci, cit,
clean-install, clean-install-test, completion, config,
create, ddp, dedupe, deprecate, dist-tag, docs, doctor,
edit, explore, get, help, help-search, hook, i, init,
install, install-ci-test, install-test, it, link, list, ln,
login, logout, ls, org, outdated, owner, pack, ping, prefix,
profile, prune, publish, rb, rebuild, repo, restart, root,
run, run-script, s, se, search, set, shrinkwrap, star,
stars, start, stop, t, team, test, token, tst, un,
uninstall, unpublish, unstar, up, update, v, version, view,
whoami
npm <command> -h quick help on <command>
npm -l display full usage info
npm help <term> search for help on <term>
npm help npm involved overview
Specify configs in the ini-formatted file:
/Users/alemkahrobek/.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config
npm#6.9.0 /usr/local/lib/node_modules/npm
Alems-MacBook-Pro:~ alemkahrobek$ npm help config
NPM-CONFIG(1) NPM-CONFIG(1)
NAME
npm-config - Manage the npm configuration files
SYNOPSIS
npm config set <key> <value> [-g|--global]
npm config get <key>
npm config delete <key>
npm config list [-l] [--json]
npm config edit
npm get <key>
npm set <key> <value> [-g|--global]
aliases: c
DESCRIPTION
npm gets its config settings from the command line, environment vari-
ables, npmrc files, and in some cases, the package.json file.
See npm help 5 npmrc for more information about the npmrc files.
See npm help 7 npm-config for a more thorough discussion of the mechanisms involved.
The npm config command can be used to update and edit the contents of
the user and global npmrc files.
Sub-commands
Config supports the following sub-commands:
set
npm config set key value
Sets the config key to the value.
If value is omitted, then it sets it to "true".
get
npm config get key
Echo the config value to stdout.
list
npm config list
Show all the config settings. Use -l to also show defaults. Use --json
to show the settings in json format.
delete
npm config delete key
Deletes the key from all configuration files.
edit
npm config edit
Opens the config file in an editor. Use the --global flag to edit the
global config.
SEE ALSO
o npm help 5 folders
o npm help 7 config
o npm help 5 package.json
o npm help 5 npmrc
For Ubuntu users who experience the same problem, I've solved it giving the right permissions on the specified folder:
chown -R $USER:$USER /home/$USER/.config/gatsby
Check out the official page on npmjs.com: https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
I would definitely the first option on that page. nvm is pretty awesome: https://github.com/creationix/nvm

Laravel error when running npm run dev command

When I run npm run dev in the terminal I get the following message:
ERROR in ./resources/js/components/ExampleComponent.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
at loadTemplateCompiler (/portal/node_modules/vue-loader/lib/index.js:21:11)
at Object.module.exports (
(/portal/node_modules/vue-loader/lib/index.js:65:35)
# ./resources/js/app.js 19:35-79
# multi ./resources/js/app.js ./resources/sass/app.scss
Can anyone tell me what this error means and how do I fix it?
I tried to run this command in the terminal, but I am still getting the error.
The command: npm i -D vue-template-compiler
I have also tried to reinstall all of my dependencies, but that didnt work either.

Gitlab runner stop after npm install

For using the pipeline in Gitlab, i've created the following .gitlab-ci.yml file:
image: node:8.2.1
cache:
paths:
- node_modules/
TestIt:
script:
- npm install
- '/node_modules/#angular/cli/bin/ng test --single-run=true --browsers PhantomJS --watch=false'
When the runner start the job it is doing the npm install successfully but by that it ends. It doesn't continue to the second script (like it ignores it from some reason).
This is the output:
What can be the cause for that?
If you are on windows, you probably ran into this problem (nothing else executing after a "npm" command):
https://gitlab.com/gitlab-org/gitlab-runner/issues/2730
TL;DR: Use call npm install instead of npm install, then the second command will execute too. Downside: Then your CI config is not platform-independent anymore.
I still didn't found the reason why this happens but as A workaround After a long search instead of using ng test, i'm using npm test, like that:
TestIt:
script:
- npm test
in
Karma.config.js
I changed from autoWatch: true to false and from singleRun: false to true to prevent continuous testing.
I took out the - npm install

Running the 'Getting-Started' Fabric Composer gets error with composer archive create; missing required options

Sequence of steps was
npm install -g composer-cli
Clone the getting started repository, and issue npm install
Lots of NPM errors are output, but some of the key ones are.
> composer archive create -m digitalproperty-network --archiveFile digitalPropertyNetwork.bna && composer network deploy --archiveFile digitalPropertyNetwork.bna --enrollId WebAppAdmin --enrollSecret DJY27pEnl16d && composer network list -n digitalproperty-network --enrollId WebAppAdmin --enrollSecret DJY27pEnl16d
composer archive create --archiveFile digitialPropertyNetwork.zip --sourceType module --sourceName digitalproperty-network
Options:
--help Show help [boolean]
-v, --version Show version number [boolean]
--archiveFile, -a Business network archive file name. Default is based on the Identifier of the BusinessNetwork [string]
--sourceType, -t The type of the input containg the files used to create the archive [ module | dir ] [required]
--sourceName, -n The Location to create the archive from e.g. NPM module directory or Name of the npm module to use [required]
Missing required arguments: sourceType, sourceName
npm ERR! Linux 4.8.0-39-generic
npm ERR! argv "/home/matthew/.nvm/versions/node/v6.10.0/bin/node" "/home/matthew/.nvm/versions/node/v6.10.0/bin/npm" "run" "deployNetwork"
npm ERR! node v6.10.0
npm ERR! npm v4.3.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! getting-started#1.0.0 deployNetwork: `composer archive create -m digitalproperty-network --archiveFile digitalPropertyNetwork.bna && composer network deploy --archiveFile digitalPropertyNetwork.bna --enrollId WebAppAdmin --enrollSecret DJY27pEnl16d && composer network list -n digitalproperty-network --enrollId WebAppAdmin --enrollSecret DJY27pEnl16d`
npm ERR! Exit status 1
The machine is clean, with no caches. Some of the other sample networks are also failing with the same error?
When the npm install -g composer-cli was issued, it installed a version of the command line tools that was at v0.4.5 or later. composer --version outputs for example.
$ composer --version
composer-cli v0.4.5
composer-admin v0.4.5
composer-client v0.4.5
composer-common v0.4.5
composer-runtime-hlf v0.4.5
composer-connector-hlf v0.4.5
The composer archive create command needs to form up the Business Network Archive from the model files, transaction files etc. It can do this in two ways
by taking a source directory
by taking a module name
The new syntax of the command is
composer archive create --archiveFile digitialPropertyNetwork.zip --sourceType module --sourceName digitalproperty-network
Options:
--help Show help [boolean]
-v, --version Show version number [boolean]
--archiveFile, -a Business network archive file name. Default is based on the Identifier of the BusinessNetwork [string]
--sourceType, -t The type of the input containg the files used to create the archive [ module | dir ] [required]
--sourceName, -n The Location to create the archive from e.g. NPM module directory or Name of the npm module to use [required]
Previously there was a --moduleName and a --inputDir name.
Examples:
To create a business network archive from the current working directory previously would have used the --inputDir . the new command is:
composer archive create --sourceType dir --sourceName . --archiveFile digitialPropertyNetwork.bna
To create a business network archive by indicating the NPM Module containing the business network would have used the --moduleName digitalproperty-network the new command is:
composer archive create --sourceType module --sourceName digitialproperty-network --archiveFile digitialPropertyNetwork.bna
In both cases above the --archiveFile digitialPropertyNetwork.bna is optional. A default filename will be created from the name of the Business Network if needed.
Why?
The inputDir and moduleName options were mutually exclusive and the internal code design was not proving resilient to handling error cases. The new approach to the options simplifies (and increases the resilience of the code).
Depending on the development approach, the artifacts that make up the business network may be created in different ways. By moving to this new style of options means we aren't precluding any other 'sourceType'. In the previous model, we would have had to add more and more command line options.

NPM has stopped working on Windows 7 64bit, hangs on install/update

At some point my version of NPM stopped working. It seems to have happened when I tried to update npm (from 1.4 shipping with node to a modern 2.x version) a few weeks ago and has steadily gotten worse. I had to change the Environment variable to point to my npm directory before my node directory (to pick up the new version of npm), at that point everything just stopped working. I switched the environment variable back, and then updates would just hang. But strangely when I tried to debug it and add a --verbose to the command the update would work most of the time. Sometimes they hung on the
npm http GET https://registry.npmjs.org/PACKAGE_NAME
but most of the time they worked. This now happens with the old version of NPM (1.4.1) and the new version that I installed (2.1.17), everything always fails on a GET command (usually but not always the first one). I have hit cache-clear, I have wiped out the temp directory, I have tried wiping out %APPDATA/roaming/npm/, and reinstalling everything. I have no proxy in place, but I have run:
npm config set proxy
to set the proxy to blank. I have set the registry to http (rather than https) and set strict-ssl to false. I have uninstalled and reinstalled nodejs, to no luck. I have tried running the commands from an admin cmd prompt rather than a normal command prompt all to no avail. I've run out of ideas, and really need NPM to work...
Below is the output of trying to install grunt-cli after clearing out the %APPDATA/roaming/npm directory:
C:\Users\Kris Erickson>npm install -g grunt-cli --verbose
npm info it worked if it ends with ok
npm verb cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
npm verb cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
npm verb cli 'install',
npm verb cli '-g',
npm verb cli 'grunt-cli',
npm verb cli '--verbose' ]
npm info using npm#1.4.28
npm info using node#v0.10.35
npm verb node symlink C:\Program Files\nodejs\\node.exe
npm verb cache add [ 'grunt-cli', null ]
npm verb cache add name=undefined spec="grunt-cli" args=["grunt-cli",null]
npm verb parsed url { protocol: null,
npm verb parsed url slashes: null,
npm verb parsed url auth: null,
npm verb parsed url host: null,
npm verb parsed url port: null,
npm verb parsed url hostname: null,
npm verb parsed url hash: null,
npm verb parsed url search: null,
npm verb parsed url query: null,
npm verb parsed url pathname: 'grunt-cli',
npm verb parsed url path: 'grunt-cli',
npm verb parsed url href: 'grunt-cli' }
npm verb lock grunt-cli C:\Users\Kris Erickson\AppData\Roaming\npm-cache\671ef8ac-grunt-cli.lock
npm verb addNamed [ 'grunt-cli', '' ]
npm verb addNamed [ null, '*' ]
npm verb lock grunt-cli# C:\Users\Kris Erickson\AppData\Roaming\npm-cache\d63f3d0b-grunt-cli.lock
npm verb request where is /grunt-cli
npm verb request registry https://registry.npmjs.org/
npm verb request id dc44ca4b260df8c3
npm verb url raw /grunt-cli
npm verb url resolving [ 'https://registry.npmjs.org/', './grunt-cli' ]
npm verb url resolved https://registry.npmjs.org/grunt-cli
npm verb request where is https://registry.npmjs.org/grunt-cli
npm info trying registry request attempt 1 at 13:36:28
npm http GET https://registry.npmjs.org/grunt-cli
/
Note: the spinner never stops (at least I have left it 10 minutes and nothing happened).
It looks like you may have installed a new npm but it is not actually being used (or did you revert back to 1.4.28?)
In either case, try following the directions here https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows for updating to the latest npm on Windows. Latest is currently 2.4.1. I recommend using Option 3.
Then try running your npm install command with maximum verbosity:
npm -ddd install -g grunt-cli
and upload your logfile as a gist https://gist.github.com either here or as a new issue at https://github.com/npm/npm/issues, and we'll help you get this sorted out.
The version number you're using doesn't comply with the semantic versionning convention npm uses: you need to specify a MAJOR.MINOR.PATCH version number.
You can either:
Use the 0.2.x notation to specify that you don't care what patch version you use, as long as the major.minor matches
Use the ~0.2.0 notation to specify that you don't care what patch version you use, as long as the major.minor matches
Read npm's documentation and semver's documentation for other possibilities...
Hope This helps.
I am running node in windows 8.1. This issue popped up on a new machine build and I searched for hours for a resolution with no success. Finally. in desperation I used fiddler in an attempt to see what calls were being made by npm AND magically the problems went away.
On further investigation I found that npm appears to require two windows environment variables to be set:
Try the following in a command prompt before running npm (Note: if you are actually behind a proxy then replace the empty quotes with your proxy address):
Setx http_proxy ""
Setx https_proxy ""

Resources