BUILD ERROR
node_modules/aws-sdk/lib/http_response.d.ts(1,25): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/lib/http_response.d.ts(14,18): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i #types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/acm.d.ts(132,37): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i #types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/acm.d.ts(134,38): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i #types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/acm.d.ts(468,32): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i #types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/acm.d.ts(470,32): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i #types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/apigateway.d.ts(1146,23): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i #types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/clouddirectory.d.ts(1573,38): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i #types/node and then add node to the types field in your tsconfig.
node_modules/aws-sdk/clients/cloudsearchdomain.d.ts(7,24): error TS2307: Cannot find module 'stream'.
node_modules/aws-sdk/clients/cloudsearchdomain.d.ts(42,23): error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try npm i #types/node and then add node to the types field in your tsconfig.enter code here
you should add
"typeRoots": [
"node_modules/#types"
]
to you tsconfig.json object. and run your server. As illustrated below. It worked for me.
tsconfig.json {
"compileOnSave": false, enter code here
"typeRoots": [
"node_modules/#types"
],
"compilerOptions":
{ "baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "es2015",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es5",
"typeRoots": [ "node_modules/#types" ],
"types": [ "node" ],
"lib": [ "es2018", "dom" ],
"paths": { "common-registration": [ "dist/common-registration" ],
"common-registration/": [ "dist/common-registration/" ] } } }
Related
I'm trying to build an installer with electron-builder but every time I generate the installer and install my application, I get an error that "dist/index" doesn't exist in .asar file. I checked and no dist file is packed inside .asar.
The error I'm getting:
Not allowed to load local resource: file:///C:/Users/user1/AppData/Local/Programs/myApp/resources/app.asar/dist/index.html
I'm building with this script:
"publish": "set GH_TOKEN=<my_token> && electron-builder --win -p always"
Does electron-builder have any flags to tell him where to put the output files?
Okey after some trial and error, I found what was wrong...
So basically my package.json was configured wrong. In order to include dist in build it must be specified like this:
...
"build": {
"appId": "si.app.testing",
...
"directories": {
"output": "release",
"buildResources": "dist"
},
"files": [
"**/*",
"dist/**/*",
...
"!.github",
"!.vs",
"!node_modules/*"
]
},
...
I would like to create a simple npm package and import that into svelte components, however, I cannot seem to use index files to import deeply nested files, e.g.
// routes/test.svelte
<script lang="ts">
import { Test } from '#my-co/my-lib/dist/folder1/folder2/test';
const test = new Test('foo', 'bar');
</script>
works, but
// routes/test.svelte
<script lang="ts">
import { Test } from '#my-co/my-lib';
const test = new Test('foo', 'bar');
</script>
does not. I have the following in the index.ts file in my npm module:
export { Test } from './folder1/folder2/test';
This strangely also does seem to work in ssr (dev server output in console seems to pick the import {Test} from '#my-co/my-lib' correctly), but not in the browser, where I get the error that Test is not a constructor...
Npm library package.json:
{
"name": "#myco/my-lib",
"version": "0.0.2",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "tsc",
"prepare": "npm run build"
},
"author": "redacted",
"license": "ISC",
"dependencies": {
"#types/rosie": "0.0.40",
"#types/slug": "^5.0.3",
"rosie": "^2.1.0",
"slug": "^5.1.1"
}
}
Npm library tsconfig
{
"compilerOptions": {
"declaration": true,
"strictNullChecks": true,
"outDir": "dist",
"moduleResolution": "node",
"module": "es2015",
"target": "es5",
"sourceMap": true,
"lib": ["es2015", "dom"],
"rootDir": "src"
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
}
Lib structure
my-lib/
| dist/
| node_modules/
| src/
| | folder1/
| | | folder2/
| | | | test.ts
test.ts
export class Test {
foo: string;
bar: string;
constructor(foo: string, bar: string) {
this.foo = foo;
this.bar = bar;
}
testMe() {
console.log("foobar", this.foo, this.bar);
}
}
The svelte-kit package command should automatically do everything for you (docs).
This Youtube video should explain everything.
The steps it provides to publish are:
npm init svelte#next project-name
cd project-name
Create component
npx svelte-kit package
cd package
Login to npm / create an account
npm publish --access public
While Caleb's answer did not really help in my case, I think it was a bit of a pointer as to what was going wrong. I did not intend to write a svelte-focused Component library, but rather a general model/factory library to be reused between the front- and backend.
I did a couple of things since this issue occurred and here is a list of things I think went wrong:
Local linking of the npm package into my project caused issues (npm link). I have very little experience with all the build tools in sveltekit but figured out where those stale/non-functional libs are referenced from. I deleted the node-modules/.vite folder which sometimes resolved my issues (I greped for seemingly cached values which led me to this directory. In my dev experience quite uncommon to have found build artifacts in node-modules, so that was a bit tedious to find in that place).
I converted my npm package to a hybrid ESM/CJS module (previously CommonJS only). I'm unsure whether that resolved the initial issues, but might be worth a try.
I think the main issue was the local linking and some sort of build caching going on in vite.
That being said, I haven't encountered any issues with the library ever since.
I build an Electron app with plugin system based on yarn (installed as node module), since I don't want to force users to install node or npm.
Some plugins depends on modules with postinstall script "node index.js".
This script failed because node doesn't exists.
Since Electron contains some version of node I thought to add the directory with electron's node to PATH, but I can't find the node binary in packaged app.
I missed something?
Can you think about any other workaround?
I use electron-packager on mac.
I don't think it's relevant to issue but here the main part of install function:
var modulePath = join(__dirname, '../', 'node_modules', 'yarn', 'bin', 'yarnpkg')
var args = ['add', `${plugin.name}#${plugin.version}`, '--json' ]
var child = fork(modulePath, args ,{ silent: true, cwd: this.pluginsPath })
process info:
{
"PATH": "/usr/bin:/bin:/usr/sbin:/sbin",
"versions": {
"http_parser": "2.7.0",
"node": "6.5.0",
"v8": "5.3.332.45",
"uv": "1.9.1",
"zlib": "1.2.8",
"ares": "1.10.1-DEV",
"modules": "50",
"openssl": "1.0.2h",
"electron": "1.4.5",
"chrome": "53.0.2785.113",
"atom-shell": "1.4.5"
}
}
I have an Electron app that I was able to debug in Visual Studio Code. After I upgraded to version 0.10.8 it will no longer run.
I am getting the error message below in my launch.json file:
Relative paths will no longer be automatically converted to absolute ones. Consider using ${workspaceRoot} as a prefix.
Absolute path to the runtime executable to be used. Default is the runtime executable on the PATH.
Here is my launch.json file:
{
"version": "0.2.0",
"configurations": [
{
"name": "My First Electron App",
"type": "node",
"request": "launch",
"program": "$(workspaceRoot}/app/main.js", //ERROR
"stopOnEntry": false,
"args": [],
"cwd": "$(workspaceRoot}",
"runtimeExecutable": "$(workspaceRoot}/node_modules/electron-prebuilt/dist/electron.app/Contents/MacOS/Electron", //ERROR
"runtimeArgs": [
"--nolazy"
],
"env": {
"NODE_ENV": "development"
},
"externalConsole": false,
"sourceMaps": false,
"outDir": null
},
{
"name": "Attach",
"type": "node",
"request": "attach",
"port": 5858
}
]
}
I am getting the green squiggly line mentioned for the two lines with //ERROR at the end.
I saw this article, but honestly was familiar with VS Code enough to understand how this should be implemented: https://code.visualstudio.com/Docs/editor/tasks#_variable-substitution
UPDATE
I replaced the value for "cwd" with "${workspaceRoot}" as recommended by Isidor. The green squiggly line went away.
I updated the error message that I am still seeing on the other two lines.
When I hit F5 I get this error message:
request 'launch': runtime executable '/private/var/git/electron-vs-code/$(workspaceRoot}/node_modules/electron-prebuilt/dist/electron.app/Contents/MacOS/Electron' does not exist
There is a typo in your json. Change the parenthesis after the $ in $(workspaceRoot} to a curly brace. This should at least fix the warning.
Even though you are getting the relative path warning VSCode still automatically converts relative to absolute paths in 0.10.8. To get rid of the warnings for "cwd", instead of "." please put "${workspaceRoot}".
What happens when you run try to debug your electron app, do you see some other error, since the relative to absolute can not be the true cause of this. If you command palette / open developper tools -> do you see some error in the console?
I can install Bower and it seems just fine via npm. I create a bower.json file using bower init, and add dependencies. Then when I use bower install, literally nothing happens in the terminal. I can use bower update to install packages, but bower install does not work and I cannot get any error to produce, even with --verbose. I've included bower.json below:
{
"name": "testing",
"version": "0.0.0",
"authors": [
"AJ"
],
"main": "index.html",
"license": "private",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"polymer": "Polymer/polymer#~0.3.0",
"core-menu": "Polymer/core-menu",
"core-ajax": "Polymer/core-ajax"
}
}
edit: using 1.3.3, but I've reproduced this using 1.3.2 as well
Try removing the bower_components directory and running bower install again.
Edit:
This is also related to a circular dependency in Polymer see: https://github.com/bower/bower/issues/1324#issuecomment-44436595