This is driving me nuts.
IDE: Visual Studion 2019
Project: Created a new "Basic Vue.js project" - I chose the *.ts flavour
I validate the new site runs. It does.
Following the quick start on Vuetify : https://vuetifyjs.com/en/getting-started/quick-start/#bootstrapping-the-vuetify-object
After each step I validate the site will still compile and run.
I reach the section where we add new modules to our project. I run this line:
npm install sass sass-loader fibers deepmerge -D
And now the site will not run. When I debug I get this output:
------ Build started: Project: MCCC.Web, Configuration: Debug Any CPU ------
> mccc.web#0.1.0 build C:\Labs\MCCC\Web\MCCC-Web\MCCC.Web
> vue-cli-service build
- Building for production...
Starting type checking service...
Using 1 worker with 2048MB memory limit
ERROR Failed to compile with 1 errors5:04:50 PM
error in ./src/main.ts
Module build failed (from ./node_modules/thread-loader/dist/cjs.js):
Thread Loader (Worker 0)
C:\Labs\MCCC\Web\MCCC-Web\MCCC.Web\babel.config.js: Error while loading config - Cannot find module 'fibers'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (C:\Labs\MCCC\Web\MCCC-Web\MCCC.Web\babel.config.js:17:32)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
# multi ./src/main.ts
ERROR Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mccc.web#0.1.0 build: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mccc.web#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Dwainwright.BC\AppData\Roaming\npm-cache\_logs\2020-04-26T21_04_50_521Z-debug.log
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VisualStudio\v16.0\Node.js Tools\Microsoft.NodejsToolsV2.targets(60,5): error MSB3073: The command "npm run build" exited with code 1.
Done building project "MCCC.Web.njsproj" -- FAILED.
Build FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
The line that sticks out the most to me is:
C:\Labs\MCCC\Web\MCCC-Web\MCCC.Web\babel.config.js: Error while loading config - Cannot find module 'fibers'
fibres is references in the babel.config.json where I added the rules laid out in quick start:
module.exports = {
presets: [
'#vue/app',
'#babel/preset-env'
],
rules: [
{
test: /\.s(c|a)ss$/,
use: [
'vue-style-loader',
'css-loader',
{
loader: 'sass-loader',
// Requires sass-loader#^7.0.0
options: {
implementation: require('sass'),
fiber: require('fibers'),
indentedSyntax: true // optional
},
// Requires sass-loader#^8.0.0
options: {
implementation: require('sass'),
sassOptions: {
fiber: require('fibers'),
indentedSyntax: true // optional
},
},
},
],
},
]
};
Does anybody know how i can resolve this? Happy to share further info; not sure what else you may need.
Are you using the latest version of the docs? I followed the link you provided and the anchor #bootstrapping-the-vuetify-object doesn't appear to exist anymore. I was able to get a basic project up and running successfully following these steps:
vue create myapp: Selected "custom" and ticked all the boxes, for TypeScript, chose the default "class-style components"
verified that npm run serve worked
vue add vuetify: Selected "Configure", and these options:
Y (default)
y
y
Material Design Icons (default)
N (default)
Y (default)
English (default)
npm run serve would run, but I got warnings about type declaration for vuetify/lib. This answer led me to this FAQ item which made the warnings go away. (You have to add "vuetify" to the compilerOptions.types array in the root tsconfig.json for the project.)
FWIW, fibers does not appear to be included in the project at all anymore (searched for "fibers" in package-lock.json). My babel.config.js file looks like:
module.exports = {
presets: [
'#vue/cli-plugin-babel/preset'
]
}
And vue.config.js looks like:
module.exports = {
transpileDependencies: [
'vuetify'
]
}
Hope this helps!
Related
Problem
node -v is working but,
npm -v is not working, error
Error encountered
C:\Users\HackerGprat>node -v
v19.2.0
C:\Users\HackerGprat>npm -v
node:internal/modules/cjs/loader:1039
const err = new Error(message);
^
Error: Cannot find module '../package.json'
Require stack:
- C:\Users\HackerGprat\AppData\Roaming\npm\node_modules\npm\lib\cli.js
- C:\Users\HackerGprat\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
←[90m at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)←[39m
←[90m at Module._load (node:internal/modules/cjs/loader:885:27)←[39m
←[90m at Module.require (node:internal/modules/cjs/loader:1105:19)←[39m
←[90m at require (node:internal/modules/cjs/helpers:103:18)←[39m
at createEnginesValidation ←[90m(C:\Users\HackerGprat\←[39mAppData\Roaming\npm\node_modules\←[4mnpm←[24m\lib\cli.js:7:15←[90m)←[39m
at module.exports ←[90m(C:\Users\HackerGprat\←[39mAppData\Roaming\npm\node_modules\←[4mnpm←[24m\lib\cli.js:73:27←[90m)←[39m
at Object.<anonymous> ←[90m(C:\Users\HackerGprat\←[39mAppData\Roaming\npm\node_modules\←[4mnpm←[24m\bin\npm-cli.js:2:25←[90m)←[39m
←[90m at Module._compile (node:internal/modules/cjs/loader:1218:14)←[39m
←[90m at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)←[39m
←[90m at Module.load (node:internal/modules/cjs/loader:1081:32)←[39m {
code: ←[32m'MODULE_NOT_FOUND'←[39m,
requireStack: [
←[32m'C:\\Users\\HackerGprat\\AppData\\Roaming\\npm\\node_modules\\npm\\lib\\cli.js'←[39m,
←[32m'C:\\Users\\HackerGprat\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js'←[39m
]
}
Node.js v19.2.0
Try : 1
walkthrough installation
👆 my doubt is i did not checked ☑ the options of automatic install necessary tools becuase it will take lots of mb so i skiped it.. and by default it was unchecked too [ ]
it did not working, and given me error,
Try : 2
it's working on sandbox but not in real pc.
Try : 3
tried to copy all installation folder from sandbox to real pc,
node -v -> working
npm -v -> not working, error
Try : 4
Trying without installing node, copied from sandbox
node -v -> working
npm -v -> not working, error
Try : 5
Tried to change the location with new name NJS
node -v -> working
npm -v -> not working, error
Try 6 : Successfully Installed npm
as you can see the last line
requireStack: [
←[32m'C:\\Users\\HackerGprat\\AppData\\Roaming\\npm\\node_modules\\npm\\lib\\cli.js'←[39m,
←[32m'C:\\Users\\HackerGprat\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js'←[39m
]
its pointing to AppData folder,
and saying there is npm folder
just delete that npm folder and reinstall the node
and see it started again working..
results
Okay so I have been trying to deploy a Next app to my Ubuntu 20.04 vps but I am unable to do so. I have uploaded all the files from my local machine to the server via ftp and then after trying to install it gets stuck and then killed ( please check the image to see where it gets stuck ). The app works perfectly in my local machine.
I tried by deleting .next directory, node_modules directory as well as package-lock.json file but the problem prevails.
Here's the Node and NPM version in my local machine:
Node: v14.15.0
NPM: v7.14.0
This is the Node and NPM version in my server:
Node: v14.18.2
NPM: v8.3.0
I have also attached my package.json file incase you want to see the dependencies
UPDATE
I some how installed the dependencies but now I am getting different type of errors when I run 'npm run dev' or 'npm run build'.
Here's what I get after I run npm run dev:
[20:09] [server1.example.com boomboom] # npm run dev
> boomboom#0.1.0 dev
> next dev
warn - Port 3000 is in use, trying 3001 instead.
ready - started server on 0.0.0.0:3001, url: http://localhost:3001
info - Loaded env from /home/user1/node-apps/boomboom/.env.local
error - ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[2].oneOf[4].use[1]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[2].oneOf[4].use[2]!./styles/Footer.module.css
/home/user1/node-apps/boomboom/node_modules/source-map/lib/util.js:101
// above the root is a no-op. Therefore we can remove all '.
SyntaxError: Unexpected end of input
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: SyntaxError: /home/user1/node-apps/boomboom/node_modules/mongodb-connection-string-url/node_modules/whatwg-url/package.json (directory description file): SyntaxError: Unexpected end of JSON input
<w> while resolving 'whatwg-url' in /home/user1/node-apps/boomboom/node_modules/mongodb-connection-string-url to a directory
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: SyntaxError: /home/user1/node-apps/boomboom/node_modules/mongodb-connection-string-url/node_modules/whatwg-url/package.json (directory description file): SyntaxError: Unexpected end of JSON input
<w> while resolving 'whatwg-url' in /home/user1/node-apps/boomboom/node_modules/mongodb-connection-string-url to a directory
This is what I get after I run npm run build:
[20:13] [server1.example.com boomboom] # npm run build
> boomboom#0.1.0 build
> next build
info - Loaded env from /home/user1/node-apps/boomboom/.env.local
info - Checking validity of types
error - ESLint: Failed to load plugin 'react' declared in '.eslintrc.json » eslint-config-next/core-web-vitals » /home/user1/node-apps/boomboom/node_modules/eslint-config-next/index.js': Cannot find module 'eslint-plugin-react' Require stack: - /home/user1/node-apps/boomboom/node_modules/eslint-config-next/index.js Referenced from: /home/user1/node-apps/boomboom/node_modules/eslint-config-next/index.js
> Build error occurred
/home/user1/node-apps/boomboom/node_modules/source-map/lib/util.js:101
// above the root is a no-op. Therefore we can remove all '.
SyntaxError: Unexpected end of input
at wrapSafe (internal/modules/cjs/loader.js:1001:16)
at Module._compile (internal/modules/cjs/loader.js:1049:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at Object.<anonymous> (/home/user1/node-apps/boomboom/node_modules/source-map/lib/source-map-generator.js:9:12)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
info - Creating an optimized production build .[20:13] [server1.example.com boomboom] #
A year ago I've made a project for a course: https://github.com/GeorgeFlorian/Finished_link_project
Now, I am trying to make it work on my machine, but I have no luck.
I've got npm 7.13.0 and node 16.1.0.
I've ran npm update in order to update all the depencies.
Steps
I've cloned the repo into a PC than runs Linux Mint 20.1
I've ran npm install
npm update
npm run build and npm run serve return the same error:
georgeflorian#georgeflorian-desktop:~/New Volume/VSCode Projects/Finished_link_project$ npm run build
> proiect-link#0.1.0 build
> vue-cli-service build
⠧ Building for production...
ERROR Failed to compile with 1 error 2:55:41 PM
Syntax Error: TypeError: Cannot read property 'parseComponent' of undefined
You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.
ERROR Build failed with errors.
I have no idea how to trace the error: Syntax Error: TypeError: Cannot read property 'parseComponent' of undefined.
Also, the NodeJS server won't start:
georgeflorian#georgeflorian-desktop:~/New Volume/VSCode Projects/Finished_link_project/server$ node app.js
node:internal/fs/utils:343
throw err;
^
Error: ENOENT: no such file or directory, stat '/home/georgeflorian/New Volume/VSCode Projects/Finished_link_project/dist/favicon.ico'
at Object.statSync (node:fs:1527:3)
at resolveSync (/home/georgeflorian/New Volume/VSCode Projects/Finished_link_project/node_modules/serve-favicon/index.js:187:17)
at favicon (/home/georgeflorian/New Volume/VSCode Projects/Finished_link_project/node_modules/serve-favicon/index.js:61:12)
at Object.<anonymous> (/home/georgeflorian/New Volume/VSCode Projects/Finished_link_project/server/app.js:46:9)
at Module._compile (node:internal/modules/cjs/loader:1109:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
at Module.load (node:internal/modules/cjs/loader:989:32)
at Function.Module._load (node:internal/modules/cjs/loader:829:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
at node:internal/main/run_main_module:17:47 {
errno: -2,
syscall: 'stat',
code: 'ENOENT',
path: '/home/georgeflorian/New Volume/VSCode Projects/Finished_link_project/dist/favicon.ico'
}
I believe that many dependencies are deprecated, but this begs two questions:
If it worked back then and it hasn't been touched since, why doesn't it work now ?
How can I fix all the deprecated dependencies if npm update did not fix them ?
Ultimately, I would like to learn how to approach this kind of situation. Thank you.
Smart people!
I’m a bundler-beginner with a bundler slash dependency-question.
On yarn dev run I get the error: "Cannot find module '#sveltejs/svelte-scroller'..."
I have a sapper/svelte/rollup/yarn-suite
the svelte-scroller-plugin
The plugin is by default loaded as an external in rollup.config.js:
{ ..., server: { ..., external: <**package.json-dependencies-arr**> } ... }
And when I use it in a .svelte-component:
import Scroller from '#sveltejs/svelte-scroller';
//...
<Scroller />
...the error slaps my face.
Notes
rollup.config.js is unchanged from the template clone
If I remove the plugin from the dependencies-arr loaded as externals in rollup.config.js the error goes away.
...which tells me that rollup shouldn't load the dependency as an external (assuming the only goal is to make the specified error vanish).
And since svelte-scroller's purpose here is client-interaction-related, I presume it shouldn't be a part of the bundle either way.
Of course cyberspace has related issues, but I can't seem to find a clear best practice example on how to handle this.
My current workaround is therefore:
// in rollup.config.js
import pkg from './package.json';
// filter out those "not external dependencies"
const notExternals = ['#sveltejs/svelte-scroller'];
const externals = Object.keys(pkg.dependencies).filter(plugin =>
notExternals.some(not => not === plugin) ? false : true
);
export default {
// ...,
server: {
// ...,
// bundle filtered externals (along with default built in modules)
external: externals.concat(require('module').builtinModules),
},
// ...
}
And if the error revisits with another dependency, I'll just add it to the notExternals-arr.
Question
Considering the sapper/svelte/rollup-setup, is this approach best practice when handling client-based plugins causing similar errors?
Thanks in advance!
Stack
internal/modules/cjs/loader.js:896
throw err;
^
Error: Cannot find module '#sveltejs/svelte-scroller'
Require stack:
- /.../__sapper__/dev/server/server.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:893:15)
at Function.Module._load (internal/modules/cjs/loader.js:743:27)
at Module.require (internal/modules/cjs/loader.js:965:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/.../__sapper__/dev/server/server.js:8:16)
at Module._compile (internal/modules/cjs/loader.js:1076:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:941:32)
at Function.Module._load (internal/modules/cjs/loader.js:782:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/.../__sapper__/dev/server/server.js'
]
}
Reproduce if you dare
template
npx degit "sveltejs/sapper-template#rollup" <app-name>
plugin
yarn add #sveltejs/svelte-scroller
import the plugin to a .svelte-component
<script>
import Scroller from '#sveltejs/svelte-scroller';
</script>
//...
<Scroller />
go
yarn run dev
Because #sveltejs/svelte-scroller is a Svelte component rather than a JS module, it must be processed by the Svelte compiler at build time rather than imported at runtime. In other words, it should be part of your bundle.
The conventional way to do this, if the contents of dependencies are treated as external, is to add the package to devDependencies instead:
yarn add -D #sveltejs/svelte-scroller
I have a very basic "Hello World" NestJS app that I'm trying to get deployed to an Azure Web App instance in Azure DevOps.
I have set up a build pipeline using a YAML file which outputs a build artifact with the dist and node_modules directories.
Then, in my release pipeline, I have a continuous deployment set up to download that artifact and deploy it. The release pipeline consists of a single step to Deploy Azure App Service. Furthermore, after this step, I entered some Post-Deployment Actions which are npm install, npm update, and npm run start:prod to get the NestJS server started.
However, when running the pipeline, that step takes an inordinate amount of time eventually erroring with:
When I visit the web app instance that I have set up (https://<project-name>.azurewebsites.net/), I see:
So, I click on "Diagnostic Resources" to try to figure out why my release is failing and eventually discover this error:
2020-05-29T20:01:30.864090341Z _____
2020-05-29T20:01:30.864143041Z / _ \ __________ _________ ____
2020-05-29T20:01:30.864149941Z / /_\ \___ / | \_ __ \_/ __ \
2020-05-29T20:01:30.864153741Z / | \/ /| | /| | \/\ ___/
2020-05-29T20:01:30.864157341Z \____|__ /_____ \____/ |__| \___ >
2020-05-29T20:01:30.864161141Z \/ \/ \/
2020-05-29T20:01:30.864164541Z A P P S E R V I C E O N L I N U X
2020-05-29T20:01:30.864167941Z
2020-05-29T20:01:30.864171141Z Documentation: http://aka.ms/webapp-linux
2020-05-29T20:01:30.864174441Z NodeJS quickstart: https://aka.ms/node-qs
2020-05-29T20:01:30.864177741Z NodeJS Version : v12.13.0
2020-05-29T20:01:30.864181041Z Note: Any data outside '/home' is not persisted
2020-05-29T20:01:30.864184441Z
2020-05-29T20:01:30.951441760Z Oryx Version: 0.2.20191105.2, Commit: 67e159d71419415435cb5d10c05a0f0758ee8809, ReleaseTagName: 20191105.2
2020-05-29T20:01:30.951840160Z Cound not find build manifest file at '/home/site/wwwroot/oryx-manifest.toml'
2020-05-29T20:01:30.951915661Z Could not find operation ID in manifest. Generating an operation id...
2020-05-29T20:01:30.952061661Z Build Operation ID: dfd18989-3b7b-4e2e-a64e-cf7310361e99
2020-05-29T20:01:32.750738663Z Writing output script to '/opt/startup/startup.sh'
2020-05-29T20:01:33.355033998Z Running #!/bin/sh
2020-05-29T20:01:33.359017599Z
2020-05-29T20:01:33.359033399Z # Enter the source directory to make sure the script runs where the user expects
2020-05-29T20:01:33.359644199Z cd "/home/site/wwwroot"
2020-05-29T20:01:33.359658399Z
2020-05-29T20:01:33.359664799Z export NODE_PATH=$(npm root --quiet -g):$NODE_PATH
2020-05-29T20:01:33.360538899Z if [ -z "$PORT" ]; then
2020-05-29T20:01:33.360552699Z export PORT=8080
2020-05-29T20:01:33.360557899Z fi
2020-05-29T20:01:33.360561499Z
2020-05-29T20:01:33.361582699Z npm start
2020-05-29T20:01:35.698639821Z
2020-05-29T20:01:35.698668521Z > <project-name>#0.0.1 start /home/site/wwwroot
2020-05-29T20:01:35.698675121Z > nest start
2020-05-29T20:01:35.698679221Z
2020-05-29T20:01:35.930729770Z internal/modules/cjs/loader.js:797
2020-05-29T20:01:35.930766970Z throw err;
2020-05-29T20:01:35.930772870Z ^
2020-05-29T20:01:35.930776770Z
2020-05-29T20:01:35.930780670Z Error: Cannot find module '../commands'
2020-05-29T20:01:35.930784670Z Require stack:
2020-05-29T20:01:35.930788470Z - /home/site/wwwroot/node_modules/.bin/nest
2020-05-29T20:01:35.930792370Z at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
2020-05-29T20:01:35.930803370Z at Function.Module._load (internal/modules/cjs/loader.js:687:27)
2020-05-29T20:01:35.930807770Z at Module.require (internal/modules/cjs/loader.js:849:19)
2020-05-29T20:01:35.930811570Z at require (internal/modules/cjs/helpers.js:74:18)
2020-05-29T20:01:35.930815370Z at Object. (/home/site/wwwroot/node_modules/.bin/nest:5:20)
2020-05-29T20:01:35.930819770Z at Module._compile (internal/modules/cjs/loader.js:956:30)
2020-05-29T20:01:35.930823570Z at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
2020-05-29T20:01:35.930827470Z at Module.load (internal/modules/cjs/loader.js:812:32)
2020-05-29T20:01:35.930831270Z at Function.Module._load (internal/modules/cjs/loader.js:724:14)
2020-05-29T20:01:35.930835070Z at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10) {
2020-05-29T20:01:35.930838970Z code: 'MODULE_NOT_FOUND',
2020-05-29T20:01:35.930842770Z requireStack: [ '/home/site/wwwroot/node_modules/.bin/nest' ]
2020-05-29T20:01:35.930846670Z }
2020-05-29T20:01:35.970252977Z npm ERR! code ELIFECYCLE
2020-05-29T20:01:35.979824678Z npm ERR! errno 1
2020-05-29T20:01:35.981324478Z npm ERR! <project-name>#0.0.1 start: `nest start`
2020-05-29T20:01:35.982002178Z npm ERR! Exit status 1
2020-05-29T20:01:35.982641778Z npm ERR!
2020-05-29T20:01:35.991823280Z npm ERR! Failed at the <project-name>#0.0.1 start script.
2020-05-29T20:01:35.991838780Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-05-29T20:01:36.118651500Z
2020-05-29T20:01:36.119439400Z npm ERR! A complete log of this run can be found in:
2020-05-29T20:01:36.128548002Z npm ERR! /root/.npm/_logs/2020-05-29T20_01_35_990Z-debug.log
At this point I can't figure out what is wrong. Any help would be greatly appreciated.
More than likely, you're using npm start which is mapped to nest start by default. The problem you'll run into with this is that #nestjs/cli (where the nest command comes from) is a part of devDependencies by default, so unless you've moved it, Azure is probably scrubbing the devDeps and keeping on prod deps. You should be using node dist/main to start your app instead to remove this problem without bloating your dependencies. Otherwise, adding #nestjs/cli to dependencies should fix it.