Now is not recognized as an internal or external command - when attempting to host a page with Zeit - hosting

"scripts": {
"start-js": "react-scripts start",
"start": "npm-run-all -p watch-css start-js",
"build": "npm run build-css && react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"build-css": "node-sass-chokidar src/ -o src/",
"watch-css": "npm run build-css && node-sass-chokidar src/ -o src/ --
watch --recursive",
"now-start": "node server/server.js",
"deploy": "now --public --dotenv=.env.prod -d"
},
"now": {
"alias": "lendahand"
}
}
Greetings. I'm trying to host a project with Zeit but I am getting an error I don't know how to fix. The error is saying that now is not an internal or external command, but it appears to be showing up in my package.json. I don't know how to remedy this situation. Do you have any suggestions?
The error is:
persona-project2-front#0.1.0 deploy C:\Users\Kim\DevMountain\LendAHandPP
> now --public --dotenv=.env.prod -d
'now' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! persona-project2-front#0.1.0 deploy: `now --public --
dotenv=.env.prod -d`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the persona-project2-front#0.1.0 deploy 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\Kim\AppData\Roaming\npm-cache\_logs\2017-11-
06T23_38_07_616Z-debug.log

Add the directory that now exists in to your PATH/path environmental variable, then you can use now. Make sure to close and re-open your terminal for the env. var. to take effect.
If that's not working, first make sure to install now like this:
npm install now -g to install it globally in your global npm/node_modules directory.
Then test it.
Thirdly, if that is not working, it could be a problem with the environmental variable not being set, so you may need to get root/administrator access and set that in the PATH env var for your system. As for the terminal, maybe try opening your terminal with admin access, or if on linux try something like sudo now.
Finally, after doing your npm install now -g it should display some messages like
'... -> C:\Users\\AppData\Roaming\npm\node_modules\now\download\dist\now ...'
Use that directory to work with now. This would open now process inside your terminal, your directory to now may be different, make sure to set this directory in your PATH if possible.

Related

How to run npm audit using the Task Runner Explorer?

I guess it is trivial, but I did not manage to figure out how to adjust my package.json so that I could run npm audit using the Task Runner Explorer by Mad Kirstensen within Visual Studio (Professional 2017).
My package.json starts with
{
"version": "1.4.6",
"name": "myProject.UI",
"private": true,
"scripts": {
"npm audit": "npm audit",
"webpack": "webpack -w --mode='development' --colors --config webpack.config.js",
}, ...
The 2nd entry in the section scripts works fine, the 1st one does not, since the Task Runner Explorer always adds a cmd.exe /c npm run as prefix to all scripts defined in package.json. This is what also what the error message says:
cmd.exe /c npm run npm audit --color=always
npm ERR! missing script: npm
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Me\AppData\Roaming\npm-cache\_logs\2020-04-01T01_23_45_6789Z-debug.log
How do I have to modify my package.json to be able to start a npm audit using the Task Runner Explorer?
Related
Can we able to run npm start from Visual Studio task runner explorer
No task runner configurations are found?
I'm afraid that in npm all script entries have a single string by design.
After all, package.json is just a json file and a such the "key" in the key/value pairs need to be a single valid string.
E.g. npm_audit instead of npm audit:
{
"version": "1.4.6",
"name": "myProject.UI",
"private": true,
"scripts": {
"npm_audit": "npm audit",
"webpack": "webpack -w --mode='development' --config webpack.config.js",
}, ...

Error When Installing node-sass for Vue JS Project

When running an 'npm install' on a VueJS project I run into the following error:
error: no matching constructor for initialization of 'v8::String::Utf8Value'
v8::String::Utf8Value string(value);
^ ~~~~~
/Users/webdevwolf/.node-gyp/12.14.1/include/node/v8.h:3046:5: note: candidate constructor not viable: no known conversion from 'v8::Local<v8::Value>' to
'const v8::String::Utf8Value' for 1st argument
Utf8Value(const Utf8Value&) = delete;
^
/Users/webdevwolf/.node-gyp/12.14.1/include/node/v8.h:3039:5: note: candidate constructor not viable: requires 2 arguments, but 1 was provided
Utf8Value(Isolate* isolate, Local<v8::Value> obj);
^
1 error generated.
make: *** [Release/obj.target/binding/src/create_string.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/node-sass/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:223:5)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 19.2.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /usr/local/lib/node_modules/node-sass
gyp ERR! node -v v12.14.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass#4.11.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass#4.11.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
To get round this I've tried the following:
Updating Node to the latest stable version
Updating sass
Running an install for the 4.11.0 version of Sass
I'm getting super frustrated with it now and I'm not even sure what this error even means - does anyone have any idea on how to fix this at all?
I was having a similar issue with Node version 16 and Vue 3.
The problem seems to be node-sass related and is incompatible with node version 16 or something. Other people have mentioned using Node 14 with no problems.
This error would happen even when I ran vue create app clicked on the manual configuration option and choose to have node-sass setup / configured. It would start downloading but freeze when it came time to download node-saas and exit with an error.
My solution was to download Vue 3 without the node-sass option and then after it was done installing, npm i -D sass sass-loader#7 instead of npm i -D node-sass
you also need to add this to you vue.config.js file in the root directory.
// vue.config.js
module.exports = {
css: {
loaderOptions: {
sass: {
implementation: require('sass'),
},
},
}
}
Thats all you should need to get scss running.
Just dont forget to add the lang="scss" attribute the the script tags.
<style lang="scss">
.....
</style>
I found my solution from this article:
https://www.priestch.com/replace-node-sass-with-dart-sass-in-vue-cli3-based-project/
I fixed this with -
npm install node-sass
If that fails then
delete your node_modules folder
npm install
npm install node-sass
Sometimes when I come back to an old vue project after using the latest version of sass I get this error. And cleaning out the modules and re-installing the correct version for my project always seems to fix it.
If you are struggling with
node 16.13.2
#vue/cli 4.5.15
vue create to create a new Vue 3 project
and you want to use node-sass but you keep having errors
Don't add a css preprocessor to your project with vue create
Create your project with vue create then use this commands (and exactly this commands)
npm i -D sass-loader#^10.0.0
npm i node-sass#^6.0.1 --unsafe-perm
There is an issue with vue and nodejs 16 issued here. node-sass (4.11) bundled with vue-cli 4.5 is incompatible with nodejs 16. What I did:
upgrade the vue-cli to the latest (currently 5.0.4)
create a new project (in my case with vue ui)
EDIT: delete old node_modules folder
compare my old package.json with the new and took over the vue specific imports
compare the configuration files for vue, typescript, jest, cypress, eslint (or whatever you use)
EDIT: Backup or commit before executing next command, because it will change your config files. Then run vue add #vue/cli-plugin-eslint (npm install will fail)
NOT absolutely necessary: start npm-gui and updated all packages to compatible versions (do not know how to do this without npm-gui) Caution: compatible is not always newer.
Here is the generated package.json for the project (TS, ESLint, Jest, Cypress, Sass, Babel, Vuex) without Router:
{
"name": "vuenew",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"test:unit": "vue-cli-service test:unit",
"test:e2e": "vue-cli-service test:e2e",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.8.3",
"register-service-worker": "^1.7.2",
"vue": "^3.2.13",
"vuex": "^4.0.0"
},
"devDependencies": {
"#types/jest": "^27.0.1",
"#typescript-eslint/eslint-plugin": "^5.4.0",
"#typescript-eslint/parser": "^5.4.0",
"#vue/cli-plugin-babel": "~5.0.0",
"#vue/cli-plugin-e2e-cypress": "~5.0.0",
"#vue/cli-plugin-eslint": "~5.0.0",
"#vue/cli-plugin-pwa": "~5.0.0",
"#vue/cli-plugin-typescript": "~5.0.0",
"#vue/cli-plugin-unit-jest": "~5.0.0",
"#vue/cli-plugin-vuex": "~5.0.0",
"#vue/cli-service": "~5.0.0",
"#vue/eslint-config-standard": "^6.1.0",
"#vue/eslint-config-typescript": "^9.1.0",
"#vue/test-utils": "^2.0.0-0",
"#vue/vue3-jest": "^27.0.0-alpha.1",
"babel-jest": "^27.0.6",
"cypress": "^8.3.0",
"eslint": "^7.32.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-vue": "^8.0.3",
"jest": "^27.0.5",
"sass": "^1.32.7",
"sass-loader": "^12.0.0",
"ts-jest": "^27.0.4",
"typescript": "~4.5.5"
}
}
EDIT2: We found some errors, which seems to be some sort of vue3 <-> TS thing.
after upgrading vue-cli to 5.0.4, tsc reports an error in a .ts (merge.ts from vue-splide) file inside node_modules. Switching back to TS 4.5.5 solved this issue.
EDIT:
In my project, I can upgrade:
typescript to 4.6.3 (current latest)
#vue/eslint-config-typescript to 10.0.0 (current latest)

Strapi Graphql Plugin Crashes Strapi Server

I just tried to install the graphql plugin for strapi (i.e., strapi-plugin-graphql). When I tried to install it via the admin interface, I got the following error message:
The restart takes longer than expected
The server should have restarted, please check your logs in the terminal
When I check my terminal, this is what I see:
[2019-12-27T07:47:12.612Z] debug GET /admin/plugins (5 ms) 200
[2019-12-27T07:47:15.882Z] info Installing graphql...
[2019-12-27T07:48:59.105Z] info File changed: C:\code\tutorials\react\Gatsby\strapi\startup-reporter\package.json[2019-12-27T07:48:59.279Z] debug POST /admin/plugins/install (103411 ms) 200
[2019-12-27T07:48:59.281Z] info The server is restarting
[2019-12-27T07:49:14.672Z] debug ⛔️ Server wasn't able to start properly.
[2019-12-27T07:49:14.674Z] error Error: Field "Query.news" can only be defined once.
at assertValidSDL (C:\code\tutorials\react\Gatsby\strapi\startup-reporter\node_modules\graphql\validation\validate.js:108:11)
at Object.buildASTSchema (C:\code\tutorials\react\Gatsby\strapi\startup-reporter\node_modules\graphql\utilities\buildASTSchema.js:71:34)
at Object.buildSchemaFromTypeDefinitions (C:\code\tutorials\react\Gatsby\strapi\startup-reporter\node_modules\graphql-tools\dist\generate\buildSchemaFromTypeDefinitions.js:23:28)
at makeExecutableSchema (C:\code\tutorials\react\Gatsby\strapi\startup-reporter\node_modules\graphql-tools\dist\makeExecutableSchema.js:26:29)
at Object.generateSchema (C:\code\tutorials\react\Gatsby\strapi\startup-reporter\node_modules\strapi-plugin-graphql\services\Schema.js:300:22)
at Object.initialize (C:\code\tutorials\react\Gatsby\strapi\startup-reporter\node_modules\strapi-plugin-graphql\hooks\graphql\index.js:59:50)
at Promise.resolve.then (C:\code\tutorials\react\Gatsby\strapi\startup-reporter\node_modules\strapi\lib\hooks\index.js:37:28)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! startup-reporter#0.1.0 dev: `strapi develop`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the startup-reporter#0.1.0 dev 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\moshe\AppData\Roaming\npm-cache\_logs\2019-12-27T07_49_14_697Z-debug.log
Any idea why I am getting this error message and how to fix it?
UPDATE:
I should note that I did a fresh install of strapi and then installed the graphql plugin -- and it installed properly. It only didn't work with an installation that already had custom post types. I don't know why that is -- and what I can do to install it with those custom post types. Any ideas?
Here is the issue about this problem
https://github.com/strapi/strapi/issues/1198
Some words are not well managed for the pluralize version.
So the issue is due to that point.
There is currently nothing to do to fix it by your own.

My vue.js + Sails.js app won't run on Heroku

I've created a web app (Vue JS frontend, Sails JS backend) that runs fine on my local server. However, when I try to run it, I get errors; mostly dependency errors. I've deployed it on Heroku. I had to create a package.json file in the root of my app folder.
Here's what the app tree looks like:
root folder
|---frontend
|---package.json file
|---backend
|---package.json file
|---package.json file
I created the frontend app with vue cli webpack.
"name": "zigy-demo-store",
"version": "1.0.0",
"description": "A demo online store with Admin functions.",
"main": "backend/app.js",
"scripts": {
"dev": "cd backend && npm i && npm run dev & cd frontend && npm i && npm run build",
"start": "cd backend && npm i && npm run dev & cd frontend && npm i && npm start"
},
"dependencies": {
"sails": ""
},
"repository": {
"type": "git",
},
"engines": {
"node": "^10.15",
"npm": "6.7.0"
}
}
Here are some errors
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/home/adesuwa/.npm-global/bin/npm', 'start' ]
2 info using npm#6.7.0
3 info using node#v10.15.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle zigy-demo-store#1.0.0~prestart: zigy-demo-store#1.0.0
6 info lifecycle zigy-demo-store#1.0.0~start: zigy-demo-store#1.0.0
7 verbose lifecycle zigy-demo-store#1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle zigy-demo-store#1.0.0~start: PATH: /home/adesuwa/.npm-global/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/media/adesuwa/Files/Programming/Dev test/zigy-demo-store/node_modules/.bin:/home/adesuwa/dart-sass/:/home/adesuwa/.npm-global/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle zigy-demo-store#1.0.0~start: CWD: /media/adesuwa/Files/Programming/Dev test/zigy-demo-store
10 silly lifecycle zigy-demo-store#1.0.0~start: Args: [ '-c',
10 silly lifecycle 'cd backend && npm i && npm run dev & cd frontend && npm i && npm start' ]
11 silly lifecycle zigy-demo-store#1.0.0~start: Returned: code: 1 signal: null
12 info lifecycle zigy-demo-store#1.0.0~start: Failed to exec start script
13 verbose stack Error: zigy-demo-store#1.0.0 start: `cd backend && npm i && npm run dev & cd frontend && npm i && npm start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/home/adesuwa/.npm-global/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:182:13)
13 verbose stack at ChildProcess.<anonymous> (/home/adesuwa/.npm-global/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:182:13)
13 verbose stack at maybeClose (internal/child_process.js:962:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid zigy-demo-store#1.0.0
15 verbose cwd /media/adesuwa/Files/Programming/Dev test/zigy-demo-store
16 verbose Linux 4.15.0-45-generic
17 verbose argv "/usr/bin/node" "/home/adesuwa/.npm-global/bin/npm" "start"
18 verbose node v10.15.0
19 verbose npm v6.7.0
20 error code ELIFECYCLE
21 error errno 1
22 error zigy-demo-store#1.0.0 start: `cd backend && npm i && npm run dev & cd frontend && npm i && npm start`
22 error Exit status 1
23 error Failed at the zigy-demo-store#1.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Looks to me to be a problem with your paths. In the error log I see that the chained command is:
cd backend && npm i && npm run dev & cd frontend && npm i && npm start
According to your tree structure there is no frontend directory inside backend directory, which makes cd frontend fail. Try adding a ../ in there to go up one level before you go into frontend:
cd backend && npm i && npm run dev & cd ../frontend && npm i && npm start
Ok so I just deployed the frontend and backend as separate apps on Heroku. I followed this tutorial for making a Vue.js + webpack deploy on Heroku: https://codeburst.io/quick-n-clean-way-to-deploy-vue-webpack-apps-on-heroku-b522d3904bc8
Instead of pushing the frontend folder though, I push only the dist/ folder located in the frontend folder. I followed the steps from the article except the git init part. I cd'ed into the dist folder and did my git init there instead.

Jasmine's exclude/focus operations cause exit status 1

I have Karma running Jasmine tests. I run these using npm scripts which, ultimately, use Angular CLI's ng test.
When I try to use xdescribe, xit, fdescribe, or fit, my tests run as expected, but I see an error.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! {my package#version} test-watch: `ng test`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the {my package#version} test-watch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm complains loudly about the error. ng test doesn't complain, but fails to go into a watch. I assume ng is also aborting because of the exit status.
Is this failed exit by design? Is it up to the reporter?
This turned out to be a failed coverage threshold. Obviously, excluding some or nearly all specs or suites greatly affected the coverage.

Resources