Angular npm link throws 404 while linking local dependency lib - node.js

As the title says, creating a link with the dependency (it shows inside my global node folder). However I am using nvm-windows which creates separate folders fore each version which may cause some issues but reading about this issue the env var NVM_SYMLINKS used to fix this.
Env variables contains NVM_SYMLINKS and it points to a nodejs installation at my main drive which according to other issues is fine.
$ npm start
> own-webpage#0.0.0 start C:\PROJECTS\HMR\HKIR\hkir\hmr\bo\frontend
> npm link lib-hkir-common-client-bo && ng serve
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/lib-hkir-common-client-bo - Not found
npm ERR! 404
npm ERR! 404 'lib-hkir-common-client-bo#latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\WORKSTATION\AppData\Roaming\npm-cache\_logs\2022-03-28T09_39_51_833Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! own-webpage#0.0.0 start: `npm link lib-hkir-common-client-bo && ng serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the own-webpage#0.0.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\WORKSTATION\AppData\Roaming\npm-cache\_logs\2022-03-28T09_39_51_877Z-debug.log
Running node -v in both directories shows that both of them are using the same versions.
I've tried deleting both node_modules, package-locks, removing the smylink from the main global recreating said symlink. But nothing seems to work.
When creating the link via npm link inside the dependency it prints out the following symlink pattern:C:\Program Files\nodejs\node_modules\lib.hkir.common.client.bo -> C:\PROJECTS\HMR\HKIR\hkir\lib.hkir.common.client.bo which once again according to others is completely fine.
How can I fix the issue so my project sees and uses the linked dependency?
Thanks.

Related

NextJS not running on MacOS even after installing modules

So I've just created a NextJS project using create-next-app which went smoothly as expected. Then ran npm i just to be sure and saw all modules installed into node_modules
When I try to run npm run dev to start my nextjs app. it just says
sh: next: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! test#0.1.0 dev: `next dev`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the test#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! /Users/john.v.n.pakson/.npm/_logs/2022-10-06T08_01_29_725Z-debug.log
It seems like npm is not detecting the node_modules i have installed.
Not sure if this is a mac or a zsh issue.
I'm using node version 12.22.12
Upgraded to 16.17.1 and still see the same error
> test#0.1.0 dev
> next dev
/var/folders/6y/xtlzp4z16dj0stxnqx8znj8w0000gn/T/dev-01c08137.sh: line 1: next: command not found
Okay I figured it out. It was caused by my file path on macos. My project was on a folder called Project/Test which might have confused zsh or mac. This in turn caused npm to not be able to find the correct scripts on my node_modules
When I moved my project to another folder I was already able to run npm run dev properly.
Cheers!

npm cannot find index.html when launching REACT front end

The problem occurs when I try to launch the front end of the app. I do this from within the frontend directory with the command: npm start. It is a MERN stack application. I am using git for version control. Others with access to the git can run npm start with no problems on their machines, so I think the problem could be related to the windows file or path systems, but haven't been able to find out.
The error given:
Could not find a required file.
Name: index.html
Searched in: C:\Users\Liam\OneDrive\Desktop\COP4935\Project\DemocracyToken\public
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! frontend#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the frontend#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\Liam\AppData\Roaming\npm-cache\_logs\2021-09-03T17_01_09_900Z-debug.log
npm appears to be trying to access the public directory from the project root (DemocracyToken) when the public directory is located in DemocracyToken/frontend/
I have tried:
rerunning npm install,
uninstalling and reinstalling node,
moving the location of the public folder,
and moving the location of index.html.
Here is the file structure of our app:

npm ERR! code E404 npm ERR! 404 Not Found - GET https://registry.npmjs.org/easier-discordjs - Not found

Hello im making my first npm package called easier-discordjs but when i do npm link in my main module folder and in my test module folder it gives an error.
npm link easier-discordjs
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/easier-discordjs - Not found
npm ERR! 404 'easier-discordjs#*' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\niels\AppData\Local\npm-cache\_logs\2021-06-22T15_59_17_982Z-debug.log
My index.js for my main module is this:
module.exports = (name) => {
return `Hello ${name}!`;
};
My index.js for my test module is this:
const greeter = require('easier-discordjs');
console.log(greeter('Niels'))
I don't know what to do.
As said in the NPM docs, you must first execute the command npm link in easier-discordjs project folder and then execute npm link easier-discordjs in your test project.
MrNossiom

Parcel command not found

In my project, I use Parcel to bundle everything. Now, I am at the point where I need to deploy my app.
I clone my git repo with my React app and I put in the Node server.
I tried every command possible to install parcel, but I always get the following error :
> pp-react#0.1.0 build /home/volodymk/react
> parcel build index.html
sh: parcel: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! pp-react#0.1.0 build: `parcel build index.html`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the pp-react#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! /home/volodymk/.npm/_logs/2020-01-12T19_26_22_634Z-debug.log
How can I fix this ?
To run any installed node package (not just Parcel), use npx, the utility command shipped with npm. It executes packages that come with a runtime command in your node_modules/packagename/.bin directories.
As in npx parcel build index.html
More information available in the npx readme.

libxmljs: scons command not found

When I was trying to deploy my node.js app (with both nodejitsu and heroku), I got the same errors with libxmljs.
> libxmljs#0.4.1 preinstall /root/tmp/tmp-31613c7bs0y8/build/package/node_modules/twilio/node_modules/libxmljs
> make node
make: scons: Command not found
make: *** [node] Error 127
npm http 200 https://registry.nodejitsu.com/css-stringify
npm http 200 https://registry.nodejitsu.com/css-parse
npm http 200 https://registry.nodejitsu.com/is-promise/-/is-promise-1.0.1.tgz
> libxmljs#0.4.1 preuninstall /root/tmp/tmp-31613c7bs0y8/build/package/node_modules/twilio/node_modules/libxmljs
> make clean
make: scons: Command not found
make: *** [clean] Error 127
npm http GET https://registry.nodejitsu.com/css-stringify/-/css-stringify-1.0.5.tgz
npm http GET https://registry.nodejitsu.com/css-parse/-/css-parse-1.0.4.tgz
npm WARN continuing anyway libxmljs#0.4.1 preuninstall: `make clean`
npm WARN continuing anyway Exit status 2
npm ERR! libxmljs#0.4.1 preinstall: `make node`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the libxmljs#0.4.1 preinstall script.
npm ERR! This is most likely a problem with the libxmljs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! make node
npm ERR! You can get their info via:
npm ERR! npm owner ls libxmljs
npm ERR! There is likely additional logging output above.
npm ERR! System SunOS 5.11
npm ERR! command "node" "/opt/local/bin/npm" "install" "--loglevel=http"
npm ERR! cwd /root/tmp/tmp-31613c7bs0y8/build/package
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.14
npm ERR! code ELIFECYCLE
As you can see, it is failing within libxmljs's 'make node' and 'make clean' as the command 'scons' is not found. I have libxmljs installed in my app's node_modules directory, and 'scons' is located at "/usr/local/bin/scons".
I believe I have to ensure that the location of scons is in the path for the make environment of libxmljs but I don't know how to do that. Any help would be appreciated!
UPDATE: Following the advice from this question (Fail to deploy node.js application to heroku) I added libxmljs to the dependencies in package.json and added node_modules/ to .gitignore, that way heroku could have a look at the dependencies and install them itself. However, the exact same error occurred, which leads me to believe the root of the problem is not with my local environment, but something larger regarding libxmljs?
I was able to resolve my problem, although it wasn't really specifically about libxmljs. I also used the 'twilio' node submodule in my app, but listed its version as '0.0.0' in dependencies. I guess twilio 0.0.0 used libxmljs which wouldn't install when deploying to heroku, so I updated the twilio version number to the actual current version, and everything's good to go!

Resources