Error when compiling webpack in npm (laravel) - node.js

Hi yesterday i shut down my pc and everything was fine. Today when i start npm run watch in my project this error ocurred.
ERROR Failed to compile with 1 errors 12:02:15 PM
This dependency was not found:
* /Users/adrianmindek/Code/Stavebniny/resources/sass/xs_app.scss in multi ./resources/js/app.js ./resources/sass/xs_app.scss
To install it, you can run: npm install --save /Users/adrianmindek/Code/Stavebniny/resources/sass/xs_app.scss
Asset Size Chunks Chunk Names
/js/app.js 1.39 MiB /js/app [emitted] /js/app
ERROR in multi ./resources/js/app.js ./resources/sass/xs_app.scss
Module not found: Error: Can't resolve '/Users/adrianmindek/Code/Stavebniny/resources/sass/xs_app.scss' in '/Users/adrianmindek/Code/Stavebniny'
# multi ./resources/js/app.js ./resources/sass/xs_app.scss /js/app[1]
I don't really know what is it or how to solve it i tried to use older package.json from older dev but nothing changed. Now my sass is no working anymore.
That file xs_app.scss is in folder ..../resources/sass/mobile/xs_app.scss what is weird becouse above in error the mobile folder is missing.
Webpack.mix.js
const mix = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/xs_app.scss', 'public/css');

you can below command just give the project folder permission to write
sudo npm install --unsafe-perm node-sass --save

Related

Cannot create a component in ember, I am met with an error every time

To generate the component, I use
$ ember generate component my-component-name
But I am met with this long error:
ENOENT: no such file or directory, lstat
'C:\Users\admin\AppData\Local\Temp\broccoli-3688mdxntFeSoJd5\out-114-broccoli_merge_trees_full_application/tests/index.html'
Expand stack frames
Broccoli Plugin: Funnel
ENOENT: no such file or directory, lstat 'C:\Users\admin\AppData\Local\Temp\broccoli-3688mdxntFeSoJd5\out-114-broccoli_merge_trees_full_application/tests/index.html'
at Funnel (Funnel (test index)) -~- created here: -~- at Funnel.Plugin
(C:\Users\admin\datatable\node_modules\broccoli-plugin\index.js:7:31)
at new Funnel
(C:\Users\admin\datatable\node_modules\broccoli-funnel\index.js:57:10)
at DefaultPackager.processTestIndex
(C:\Users\admin\datatable\node_modules\ember-cli\lib\broccoli\default-packager.js:944:17)
at DefaultPackager.packageTests
(C:\Users\admin\datatable\node_modules\ember-cli\lib\broccoli\default-packager.js:906:26)
at EmberApp._legacyPackage
(C:\Users\admin\datatable\node_modules\ember-cli\lib\broccoli\ember-app.js:1729:46)
at EmberApp.toTree
(C:\Users\admin\datatable\node_modules\ember-cli\lib\broccoli\ember-app.js:1766:27)
at module.exports (C:\Users\admin\datatable\ember-cli-build.js:23:14)
at Builder.readBuildFile
(C:\Users\admin\datatable\node_modules\ember-cli\lib\models\builder.js:52:14)
at Builder.setupBroccoliBuilder
(C:\Users\admin\datatable\node_modules\ember-cli\lib\models\builder.js:66:22)
at new Builder
(C:\Users\admin\datatable\node_modules\ember-cli\lib\models\builder.js:32:10)
-~- (end) -~-
Error: ENOENT: no such file or directory, lstat 'C:\Users\admin\AppData\Local\Temp\broccoli-3688mdxntFeSoJd5\out-114-broccoli_merge_trees_full_application/tests/index.html'
at Object.lstatSync (fs.js:863:3)
at symlinkWindows (C:\Users\admin\datatable\node_modules\symlink-or-copy\index.js:126:25)
at Function.symlinkOrCopySync [as sync] (C:\Users\admin\datatable\node_modules\symlink-or-copy\index.js:83:5)
at Funnel._copy (C:\Users\admin\datatable\node_modules\broccoli-funnel\index.js:494:19)
at Funnel.processFile (C:\Users\admin\datatable\node_modules\broccoli-funnel\index.js:477:8)
at Funnel.applyPatch [as _applyPatch] (C:\Users\admin\datatable\node_modules\broccoli-funnel\index.js:390:12)
at Funnel. (C:\Users\admin\datatable\node_modules\broccoli-funnel\index.js:344:10)
at Array.forEach ()
at Funnel.processFilters (C:\Users\admin\datatable\node_modules\broccoli-funnel\index.js:343:11)
at Funnel.build (C:\Users\admin\datatable\node_modules\broccoli-funnel\index.js:259:10)
My code works perfectly before generating a controller.
I am using broccoli-builder#2.0.1, node#v11.6.0, running on Windows 7
Add ons:
amd-transform (unknown version) Couldn't find find info about this
package
tests-server-middleware (unknown version) Couldn't find find info
about this package
history-support-middleware (unknown version) Couldn't find find info
about this package
live-reload-middleware (unknown version) Couldn't find find info about
this package
broccoli-watcher (unknown version) Couldn't find find info about this
package
broccoli-serve-files (unknown version) Couldn't find find info about
this package
proxy-server-middleware (unknown version) Couldn't find find info
about this package
testem-url-rewriter (unknown version) Couldn't find find info about
this package
#ember/jquery (0.5.2) The default blueprint for ember-cli addons.
#ember/optional-features (0.6.4) The default blueprint for ember-cli
addons.
ember-addons-inspector (1.1.0) Inspect the addons included in your
Ember application or Ember addon
ember-ajax (3.1.3) Service for making AJAX requests in Ember
applications.
ember-cli-app-version (3.2.0) Adds App version number to Ember
Inspector Info Tab
ember-cli-babel (7.2.0) Ember CLI addon for Babel
ember-cli-dependency-checker (3.1.0) Ember CLI addon for detecting
missing npm and bower dependencies before executi g ember commands
ember-cli-htmlbars (3.0.1) A library for adding htmlbars to ember CLI
ember-cli-htmlbars-inline-precompile (1.0.5) Precompile inline
HTMLBars templates via ES6 tagged template strings
ember-cli-uglify (2.1.0) JavaScript minification for Ember-CLI
broccoli-asset-rev (2.7.0) broccoli asset revisions (fingerprint)
ember-cli-sri (2.1.1) SRI generation for Ember CLI
ember-cli-template-lint (1.0.0-beta.2) Lint your handlebars templates.
ember-data (3.7.0) A data layer for your Ember applications.
ember-export-application-global (2.0.0) Sets window.MyAppName up as
the application instance upon boot.
ember-load-initializers (1.1.0) A tiny add-on to autoload your
initializer files in ember-cli.
ember-maybe-import-regenerator (0.1.6) The default blueprint for
ember-cli addons.
ember-resolver (5.0.1) The default modules based resolver for Ember
CLI.
ember-source (3.7.0) A JavaScript framework for creating ambitious web
applications
ember-welcome-page (3.2.0) Welcome page for Ember CLI applications
loader.js (4.7.0) loader.js =========
ember-qunit (3.5.3) QUnit helpers for testing Ember.js applications
qunit-dom (0.8.4) High Level DOM Assertions for QUnit
I am also getting a message that ember-cli-babel 5.x has been deprecated. Not sure if its related.
does ember g component my-name result in the same thing?
I'd debug like this:
rm -rf node_modules tmp dist
npm install
npm uninstall -g ember-cli
npm install -g ember-cli#whatever-version
ember g component my-name
if that doesn't work, if you need to get unblocked, here is what it would give you:
import Component from '#ember/component';
export default Component.extend({
});
depending on your ember version, of course.
Fixed this by deleting my tests folder, by recommendation of: https://github.com/ember-cli/ember-cli-test-loader/issues/24#issuecomment-264444621
I would recommend you to delete tmp folder and node modules.The problem usually lies in tmp folder with broccoli but to be sure delete node modules too. Then update your node js(11.9) and npm install to install everything of your pakcage.json. Then try again to generate a component.
npm -g rm to remove node modules.

I am compiling a node.js project with typescript but I am not sure how to run individual scripts

I have a node.js project that I am compiling with typescript, it just occured to me, that I have a scripts directory for running various non-server tasks, such as a seed file. I can no longer call these files directly because they are now typescript, how do I run them individually? Or what am I supposed to do with them?
For info, I have a directory scripts:
| `~scripts/
| |-masterList.csv
| |-masterList.origin.csv
| `-seed.ts
You can use the ts-node package. It will compile TypeScript files at runtime and execute them as regular JS.
npm i -g ts-node
ts-node scripts/seed.ts

#google-cloud/speech node modules being created with v64-darwin, v51 needed

I am creating a panel in Adobe Premiere Pro which used Google Cloud speech. I am accessing google-cloud/speech on the Javascript side, not JSX side via NodeJS. I am also accessing google-cloud/storage. No big deal, I installed NodeJS on a Mac and functions accessing google-cloud/storage were easy to code.
After following the instructions to npm --save #google-cloud/speech and npm --save #google-cloud/storage, it created the node_modules directory. I have moved them to a custom directory but they are duplicated in the standard location also.
In my code, I reference them as per the google-cloud examples:
// note cep.node is required in the Adobe CEP environment to access nodejs
const speech = cep_node.require(extention_path+'/lib/node_modules/#google-cloud/speech');
const project_id ='project_id_xxx1234';
const keyFilePath = extention_path +'/path/to/key.json';
const client = new speech.v1.SpeechClient({
projectId: project_id,
keyFilename: keyFilePath,
});
I've tried this w/o the ids and speech.SpeechClient() etc as per examples. The methodology is working fine with google-cloud/storage, so I know the similar downloaded node modules at the same location work fine for that.
However, it fails on trying to make a new speech.SpeechClient() with the browser debug error below.
Uncaught Error: Failed to load gRPC binary module because it was not installed for the current system
Expected directory: node-v51-darwin-x64-unknown
Found: [.DS_Store, node-v64-darwin-x64-unknown]
This problem can often be fixed by running "npm rebuild" on the current system
Original error: Cannot find module '/Library/Application Support/Adobe/CEP/extensions/com.iv.PProPanel/lib/node_modules/grpc/src/node/extension_binary/node-v51-darwin-x64-unknown/grpc_node.node'
at Object. (/Library/Application Support/Adobe/CEP/extensions/com.iv.PProPanel/lib/node_modules/grpc/src/grpc_extension.js:53:17)
at Module._compile (module.js:595:32)
at Object.Module._extensions..js (module.js:610:10)
at Module.load (module.js:512:32)
at tryModuleLoad (module.js:471:12)
at Function.Module._load (module.js:463:3)
at Module.require (module.js:522:17)
at require (internal/module.js:20:19)
at Object. (/Library/Application Support/Adobe/CEP/extensions/com.iv.PProPanel/lib/node_modules/grpc/src/client_interceptors.js:145:12)
at Module._compile (module.js:595:32)
My belief is that these series of node_modules that are accessed by #google-cloud/speech were compiled use NODE_MODULE_64 and need 51 (instead).
$ npm rebuild rebuilds (or checks current version of the modules) fine with the exception
protobufjs#6.8.8 postinstall /Library/Application Support/Adobe/CEP/extensions/com.iv.PProPanel/lib/node_modules/protobufjs
node scripts/postinstall
grpc#1.14.1 install /Library/Application Support/Adobe/CEP/extensions/com.iv.PProPanel/lib/node_modules/grpc
node-pre-gyp install --fallback-to-build --library=static_library
node-pre-gyp WARN Using request for node-pre-gyp https download
[grpc] Success: "/Library/Application Support/Adobe/CEP/extensions/com.iv.PProPanel/lib/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown/grpc_node.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
So some module needs v51 instead of the build v64. The question is can the #google-cloud/speech modules be built using v51 and how? or do I wait for google-cloud to come up with a solution? BTW: I also renamed the node-v64 dir to node-51, but received another error referencing the MODULE 51. Any direction would be appreciated.
Some of the dependencies for #google-cloud/speech are native addons. Those being C/C++ code, they need to be compiled for the correct Node version. Looks like your Node version that you used for npm install doesn't match the one in Adobe CEP. Switch to Node 5.1 and run npm install or npm rebuild again.
I recommend using nvm to change Node versions, see Node Version Manager.

Error with Webpack and Angular Fullstack installing 3rd party npm modules

So I have been working with angular fullstack for a while now. I am having an issue with webpack at this point. I need to install an npm module called bb-rest which can be found [here][1].
This module is an extension of Blackboard Learns public API for Developers. When install the module into the project, and add it to the app.js file as I normally do other NPM modules, Webpack throws a fit. It is not able to find module 'fs' and from there more errors come up.
Item | Version
----- | -----
generator-angular-fullstack | 4.2.2
Node | 6.11.3
npm | 5.4.1
Operating System | OS X 10
Item | Answer
----- | -----
Transpiler | Babel
Markup | HTML
CSS | SCSS
Router | ngRoute
Client Tests | Jasmine
DB | SQL
Auth | Y
NPM MODULE: bb-rest
I have looked through many of the previous issues with the error 'Cannot resolve module 'fs'' and have done changes to the config variable in the webpack.make.js file from solutions such as these.
Here
This one as wel
Tried this as well
Last Resort
When I attempt to inject the dependency in the app.js file, webpack upon compiling throws a fit. I've tried the approaches in the links provided above in order to resolve this with no luck. I even tried simply importing the required dependency into my controller, or a specific file where I need it, and webpack goes crazy. I set up a test project with just a simple node/express webapp and that works fine. I'm not too familiar with webpack and it's inner workings so I was wondering if anyone had any similar issues when trying to use third party npm modules in the stack.
Console Error Produced by Webpack upon compiling: pastebin.com/26RmwEUZ

Deploying NodeJS/Babel/Grunt app on Heroku

I'm trying to deploy my project on Heroku. I've been able to heroku open the app and see it but I get a 404 on my bundle.js. The app is on github here. The app is on heroku here.
I've tried making sure my dependencies are all there regarding babel, babelify, grunt, etc. But I must be still missing something.
I don't get any errors after my git push heroku but I still get my 404.
I am able to recreate this locally as well. This is what I get when I run your postinstall script code:
$ npm run postinstall
> ncps-mms#0.0.0 postinstall ncps-mms
> gulp transpile --gulpfile client/gulpfile.babel.js
[00:18:43] Requiring external module babel-register
[00:18:43] Working directory changed to ncps-mms/client
(node:30276) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
[00:18:43] Using gulpfile ncps-mms/client/gulpfile.babel.js
[00:18:44] Starting 'transpile'...
Error: Cannot find module './controllers/members-detail-controller' from 'ncps-mms/client/src'
[00:18:44] Finished 'transpile' after 184 ms
I see this error:
Error: Cannot find module './controllers/members-detail-controller' from 'ncps-mms/client/src'
The members-detail-controller is missing - See: https://github.com/gh0st/ncps-mms/tree/master/client/src/controllers.
If I comment out the following lines, https://github.com/gh0st/ncps-mms/blob/master/client/src/app.js#L4 and https://github.com/gh0st/ncps-mms/blob/master/client/src/app.js#L15 then run npm run postinstall again, the gulp tasks run without errors. I am then able to start the server without the 404's on bundle.js.

Resources