I have a basic express.js server setup on my Mac. To this I'm trying to import Tone.js, https://tonejs.github.io, by following the instructions.
npm install tone
To import Tone.js:
import * as Tone from 'tone'
But I'm getting this error
Uncaught TypeError: Failed to resolve module specifier "tone". Relative references must start with either "/", "./", or "../".
My Package file looks like this
{
"name": "XXXXX",
"version": "1.0.0",
"description": "Run npm start",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon start"
},
"repository": {
"type": "git",
"url": "git+https://github.com/xxxxx"
},
"author": "xxxxx xxxx",
"license": "ISC",
"bugs": {
"url": "https://github.com/xxxxxxx"
},
"dependencies": {
"express": "^4.17.1",
"nodemon": "^2.0.12",
"tone": "^14.7.77"
}
}
As #lars-flieger pointed out, it's not possible to run it one a node.js server.
I ended up downloading Tones.js from here and includes it as a regular script tag.
https://github.com/Tonejs/Tone.js/wiki/Installation
Related
I'm getting the an error on terminal while trying to compile the code, but I don't understand why.
Code:
const express = require("express");
const app = express();
console.dir(app);
Error:
package.json:
{
"name": "firstapp",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.18.1",
"npm": "^8.15.0"
}
}
first, check that express is installed or not
if not run the following command
npm i express
also, check that you are using the latest version of the node
if all ok then run
node index.js
is still an issue not fixed submit your folder structure and package.json
so I can give you further assistance
Remove npm from dependency
I had a project that was previously using lite-server. I can no longer get it to run using
npm run
I see the following from the console
PS C:\Users\XXX\Documents\Work\Repos\Homepage_Slider> npm run
Lifecycle scripts included in homepage_slider: test
echo "Error: no test specified" && exit 1 start
lite-server
I don't really understand why this isn't working anymore.
I've tried:
Updating NPM
Running lite-server globably
Make sure package.json is set up correctly
Here is my package.json file
{
"name": "homepage_slider",
"version": "1.0.0",
"description": "A simple slider for homepage",
"main": "index.html",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "lite-server"
},
"repository": {
"type": "git",
"url": "XXX"
},
"keywords": [
"Slider"
],
"author": "XXX",
"license": "ISC",
"devDependencies": {
"lite-server": "^2.3.0"
},
"dependencies": {
"npm": "^6.0.1"
}
}
npm run is a reserved word for npm itself. Check the documentation
What you really need is npm start which is a shortcut for npm run start which is a shortcut for npm run-script start!
If you're attempting to help me, I really appreciate it.
So when I write git push heroku master, it fails to parse, and before you spit at me and say 'READ OTHERS!!!!' I have. I've rewritten the package.JSON and used a validator. The strange thing is it always says line 9, column 3, every time I reformat the package.JSON, always line 9, column 3. I have changed over 5-7 times. I don't think my package.json is necessary as it always brings that error.
But here it is anyway.
{
"name": "vulture",
"version": "1.0.1",
"description": "Vulture is a bot for discord.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"engines": {
"node": "8.4.0",
"npm": "5.4.0"
},
"author": "swagehsaan840#0336",
"license": "MIT"
}
A side note is changing it will probably give me the same error, but I never know, after using a validator and changing any times, it always says line 9, column 3.
Thanks anyway! :)
try to write this way package.json
{
"name": "vulture",
"version": "1.0.0",
"description": "vulture",
"main": "index.js",
"private": true,
"scripts": {
"start": "node index.js",
},
"author": "vulture",
"license": "ISC",
"dependencies": {
"node": "8.4.0",
"npm": "5.4.0"
}
}
add Buildpacks in heroku goto setting select add Buildpacks --> select nodejs
The structure of my project looks like this:
And my package.json looks like this:
{
"name": "personal_site",
"version": "1.0.0",
"description": "My personal website.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "node-sass --output-style compressed ./dist/css/bundle.min.css ./src/scss/styles.scss",
"serve": ""
},
"author": "Dean Gibson",
"license": "ISC",
"dependencies": {
"bourbon": "^4.2.6",
"bourbon-neat": "^1.7.4"
},
"devDependencies": {
"node-sass": "^3.4.2"
}
}
But when I run npm build it looks like the terminal is "thinking" and it stops without throwing any errors. But nothing gets generated in dist/css/ ... Anything obvious that I'm doing wrong here?
UPDATE:
This is interesting, if I run that exact script directly from terminal then it works fine... Any ideas as to why?
I'm trying to write a test automation script using appium, jasmine, and perfecto mobile. I'm using the project cloned from the following URL with my own configuration Appium Javascript Example
The problem is when I execute the npm test command I get the following error
node_modules is not recognized as an internal or external command
This is how the packages.json script looks like:
{
"name": "perfecto_appium_sample",
"version": "1.0.0",
"description": "The following sample shows how to Install an application and use WebDriverIO to automate and test it.<br/> It uses selendroid test application which can be downloaded from [here](https://github.com/PerfectoCode/AppsForSamples/tree/master/selendroid-test-app-0.17.0).",
"main": "perfectoSpec.js",
"scripts": {
"test": "node_modules/webdriverio/bin/wdio wdio.conf.js",
"start": "wdio wdio.conf.js"
},
"author": "",
"license": "ISC",
"devDependencies": {
"wdio": "^0.3.3",
"wdio-jasmine-framework": "^0.2.19",
"wdio-mocha-framework": "^0.5.12"
},
"dependencies": {
"wd": "^1.5.0",
"webdriverio": "^4.10.2"
},
"keywords": []
}
you need to provide relative path properly:
"scripts": {
"test": "node ./node_modules/webdriverio/bin/wdio wdio.conf.js",
"start": "wdio wdio.conf.js"
}
Just remove the paths "node_modules/webdriverio/bin/" and simply specify "wdio wdio.conf.js". It should work.