I am trying to setup a express.js server using there generator. I have followed the documation and I have succesfully created the basic structure. However if I try to run the given command (SET DEBUG=transcriptverificationserver:* & npm start) to start the server I always get the following error:
npm ERR! Missing script: "start"
npm ERR!
npm ERR! Did you mean one of these?
npm ERR! npm stars # View packages marked as favorites
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR! npm run
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\a\AppData\Local\npm-cache\_logs\2022-11-28T22_43_43_285Z-debug-0.log
PS C:\Users\a\Desktop\Verified Transcripts\Webpage> npm start
npm ERR! Missing script: "start"
npm ERR!
npm ERR! Did you mean one of these?
npm ERR! npm star # Mark your favorite packages
npm ERR! npm stars # View packages marked as favorites
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR! npm run
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\a\AppData\Local\npm-cache\_logs\2022-11-28T22_45_41_209Z-debug-0.log
I assume its an issue within the package.json file. The script part looks as following:
"scripts": {
"start": "node ./bin/www"
},
I haven´t change anything in the files or structure and I was simply copying the commands from the documentation (https://expressjs.com/en/starter/generator.html)
Thanks for any help in advance
I have tried it again and this time everthing works. I am not sure what has happend before but I might have used the old installation method.
$ npm install -g express-generator
$ express
With my secound try I ensured to use the new method:
$ npx express-generator
Related
I am trying install ejs in my project and its first time i am doing so.
I tried several commands but none of them seem to work.
Some Commands that i tried are given below :
npm i ejs
npm i ejs --save
npm i ejs -g
npm ERR! code ENOSELF
npm ERR! Refusing to install package with name "ejs" under a package
npm ERR! also called "ejs". Did you name your project the same
npm ERR! as the dependency you're installing?
npm ERR!
npm ERR! For more information, see:
npm ERR! <https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm>
npm ERR! A complete log of this run can be found in:
What could be causing this and how can i fix this
In package.json you likely named your project "ejs", in which case it gives an error like that, rename your project to something else then try install ejs again.
Black#DESKTOP-N04CDRI MINGW64 /c/web devlopment/react-chat-application/chat-application (master)
$ npm start
chat-application#0.1.0 start C:\web devlopment\react-chat-application\chat-application
react-scripts start
Could not find a required file.
Name: index.js
Searched in: C:\web devlopment\react-chat-application\chat-application\src
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! chat-application#0.1.0 start: react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the chat-application#0.1.0 start 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\Black\AppData\Roaming\npm-cache_logs\2021-09-29T15_56_51_774Z-debug.log
Black#DESKTOP-N04CDRI MINGW64 /c/web devlopment/react-chat-application/chat-application (master)
$
you may have deleted index.js file or renamed it.if you are using react-create-app pipeline then you can't rename that or remove this file so make sure it's present in your src folder inside project dir and if you are using git then run git status it will tell you what you had changed.
index.html has been moved/removed from the /public directory
Does your project have an index.js file in the public directory?
If not you can get the one that Create React App uses here
I tried to install websocket via " npm install ws" , but it always returned
npm ERR! code ENOSELF
npm ERR! Refusing to install package with name "ws" under a package
npm ERR! also called "ws". Did you name your project the same
npm ERR! as the dependency you're installing?
npm ERR!
npm ERR! For more information, see:
npm ERR! https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/croydon/.npm/_logs/2021-03-18T00_55_40_611Z-debug.log
please could you help on how to fix it?
Thanks!
I've only been successful installing ws globally.
Note that the old way of installing globally is deprecated.
You will get an error message with instructions if you try it.
The new way:
npm install --location=global ws
This error is shown whenever i try to build the project. Can someone please help me with this
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! covid-19-world#0.1.0 build: react-scripts build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the covid-19-world#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\uniqf\AppData\Roaming\npm-cache_logs\2020-09-02T16_41_30_577Z-debug.log
The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command npm run build" terminated with exit code: 1.
You can try the following -
Delete the node_modules folder
Delete the package-lock.json if it exists
run npm install in the terminal
Yes I found the problem and solved it by removing the cache, Doing what SFUE said above and created a new project with all the source code of earlier and I was able to build the project
ok ... first time I'm trying my hand at node.js.
installed it a while back, and not sure how i installed it.
last night, decided to tackle a tutorial regarding node.js and express.
checked my version of node which is v0.8.14 and npm which is 1.1.65. (I'm on Mac, 10.6.8 version)
but did this anyway
npm install -g express
seemed to go ok ... but whenever I tried to generate a new application via
express new ProjectName
I got this:
-bash: express: command not found
Decided to try
sudo npm install express -g
which again seemed to go well ... but again, the express new ProjectName got the same statement.
tried again:
npm install -g express
got a lot of errors unlike the first time.
npm WARN package.json application-name#0.0.1 No README.md file found!
AA-s-MacBook-Pro:express_node aa$ express new HotPie
-bash: express: command not found
AA-s-MacBook-Pro:express_node aa$ npm cache clean
AA-s-MacBook-Pro:express_node aa$ npm install -g express
npm http GET https://registry.npmjs.org/express
npm http 200 https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/express/-/express-3.0.6.tgz
npm http 200 https://registry.npmjs.org/express/-/express-3.0.6.tgz
npm ERR! error rolling back Error: EPERM, chmod '/usr/local/share/npm/bin/express'
npm ERR! error rolling back express#3.0.6 { [Error: EPERM, chmod '/usr/local/share /npm/bin/express']
npm ERR! error rolling back errno: 50,
npm ERR! error rolling back code: 'EPERM',
npm ERR! error rolling back path: '/usr/local/share/npm/bin/express' }
npm ERR! Error: EPERM, chmod '/usr/local/share/npm/bin/express'
npm ERR! { [Error: EPERM, chmod '/usr/local/share/npm/bin/express']
npm ERR! errno: 50,
npm ERR! code: 'EPERM',
npm ERR! path: '/usr/local/share/npm/bin/express' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 10.8.0
npm ERR! command "/usr/local/Cellar/node/0.8.14/bin/node" "/usr/local/bin/npm" "install" "-g" "express"
npm ERR! cwd /Users/aa/Documents/express_node
npm ERR! node -v v0.8.14
npm ERR! npm -v 1.1.65
npm ERR! path /usr/local/share/npm/bin/express
npm ERR! code EPERM
npm ERR! errno 50
npm ERR! stack Error: EPERM, chmod '/usr/local/share/npm/bin/express'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/aa/Documents/express_node/npm-debug.log
npm ERR! not ok code 0
and so it went on and on: errors ... or no errors. I'm at total loss. and online literature on fixing this problem seems rather sparse.
advice, please?
oh, also saw this somewhere online: (whatever it means)
/usr/local/share/npm/bin/express
which resulted in this:
destination is not empty, continue?
destination is not empty, continue? (yes or no) yes
create : .
create : ./package.json
create : ./app.js
create : ./public/javascripts
create : ./public/images
create : ./public/stylesheets
create : ./public/stylesheets/style.css
create : ./routes
create : ./routes/index.js
create : ./routes/user.js
create : ./views
create : ./views/layout.jade
create : ./views/index.jade
create : ./public
install dependencies:
$ cd . && npm install
run the app:
$ node app
so ... ??? any advice would be appreciated! (please also let me know if I left any pertinent information required)
Sounds like you need to edit your path variable.
Edit your ~/.bash_profile. Add this export somewhere.
export PATH=/usr/local/bin:$PATH:/usr/local/share/npm/bin
What's happening is that node isn't setting up its PATH correctly. I've had this happen to me before. Its something they should fix.
You may not have a .bash_profile. In *nix systems, there are a few different files you can place in your home directory to add environment variables and such.
bash_profile is the one I prefer, so in the terminal cd to ~ and touch .bash_profile.
Then edit it via nano .bash_profile or whatever editor you like.
(In nano, control-o to save, control-x to exit.)
When you've added it, do: source .bash_profile
Then try which express and see if it shows the path.