snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

Importer not showing anything after running npm install and npm run prod

Open mikaeldiok opened this issue 5 years ago • 5 comments

Please confirm you have done the following before posting your bug report:

Describe the bug Hi, this is my first time opening an issue on snipe-it. After I run the command npm install and npm run prod The import page is blank and there is an error like shown in screenshot below. I also trying to clone and installing new project from the github repo, and after running npm install and npm run prod without changing anything except the .env the import page also blank. could someone confirm if this is a bug or this only happens to my version of npm?

To Reproduce Steps to reproduce the behavior:

  1. install newly cloned snipe-it (optional)
  2. run npm install
  3. run npm run prod
  4. open the "Import" page

Expected behavior the import page appear

Screenshots image image image image

Server (please complete the following information):

  • Version v5.1.5 - build 6055 (master
  • OS:Ubuntu
  • Web Server: lamp
  • NPM : 6.14.4
  • Vue : 2.6.10

Error Messages

  • all.js?id=a984b7f99966cea1edbb:1 ReferenceError: importErrors is not defined

Additional context

  • Fresh installation
  • Not changing anything except .env for the database information

mikaeldiok avatar May 26 '21 04:05 mikaeldiok

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

welcome[bot] avatar May 26 '21 04:05 welcome[bot]

Hi, there it has been 22 days since I first post this issue. So apparently, the importer component is not loaded even after the definition in the vue.js resource. and after doing research these 3 weeks I found that changing the 'require' statement to async import ( () => import ) solves this problem.

so what I have done is change the vue.js import statement from this:

Vue.component( 'importer', require('./components/importer/importer.vue') );

to this: Vue.component( 'importer', () => import('./components/importer/importer.vue') );

I also change the components object for importer.vue and importer-file.vue to this:

//importer.vue components: { alert: () => import('../alert.vue'), errors: () => import('./importer-errors.vue'), importFile: () => import('./importer-file.vue'), }

and

//importer-file.vue components: { select2: () => import('../select2.vue') }

after that I run npm run prod and the importer is working flawlessly.

I hope this helps someone, and I'm waiting for maybe a more elegant solution for this problem

mikaeldiok avatar Jun 17 '21 06:06 mikaeldiok

Hi @mikaeldiok,

May I know where would the vue.js be located at? I am unable locate the file & may you also enlighten me on which line of command to reference to?

Thanks.

geek2guru avatar Jun 29 '21 03:06 geek2guru

Hi @geek2guru

sure, my vue.js is as same as the original source. you can find it at resources/assets/js/vue.js. you can see the list of vue component which loaded by the application in there.

sorry for the late reply.

mikaeldiok avatar Jul 05 '21 07:07 mikaeldiok

You actually should never have had to run npm anything, as we always bundle the script assets with the repo. Regardless, we haven't used vue in quite some time, so I'll close this issue. Let us know if you have any issues with the modern importer.

snipe avatar Aug 12 '25 04:08 snipe